commit bash-20041111 snapshot

This commit is contained in:
Chet Ramey
2011-12-03 13:39:30 -05:00
parent d11b8b46f0
commit ec2199bd30
27 changed files with 1590 additions and 117 deletions
+4
View File
@@ -417,6 +417,10 @@ static int enable_secure;
}
#endif
#ifndef HAVE_RAISE
# define raise(x) kill (getpid (), (x))
#endif
/* Get the function to evaluate the plural expression. */
#include "eval-plural.h"
File diff suppressed because it is too large Load Diff
+2 -2
View File
@@ -29,10 +29,10 @@ extern int malloc_trace;
static int _mtrace_verbose = 0;
extern FILE *_imalloc_fopen __P((char *, char *, char *, char *, size_t));
#ifdef MALLOC_TRACE
extern FILE *_imalloc_fopen __P((char *, char *, char *, char *, size_t));
FILE *_mtrace_fp = NULL;
extern char _malloc_trace_buckets[];
+122
View File
@@ -0,0 +1,122 @@
/* trace.c - tracing functions for malloc */
/* Copyright (C) 2001-2003 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne Again SHell.
Bash is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free
Software Foundation; either version 2, or (at your option) any later
version.
Bash is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License along
with Bash; see the file COPYING. If not, write to the Free Software
Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. */
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#include <stdio.h>
#include "imalloc.h"
extern int malloc_trace;
static int _mtrace_verbose = 0;
extern FILE *_imalloc_fopen __P((char *, char *, char *, char *, size_t));
#ifdef MALLOC_TRACE
FILE *_mtrace_fp = NULL;
extern char _malloc_trace_buckets[];
void
mtrace_alloc (tag, mem, size, file, line)
const char *tag;
PTR_T mem;
size_t size;
const char *file;
int line;
{
if (_mtrace_fp == NULL)
_mtrace_fp = stderr;
if (_mtrace_verbose)
fprintf (_mtrace_fp, "alloc: %s: %p (%d bytes) from '%s:%d'\n",
tag, mem, size, file ? file : "unknown", line);
else
fprintf (_mtrace_fp, "alloc:%p:%d:%s:%d\n",
mem, size, file ? file : "unknown", line);
}
void
mtrace_free (mem, size, file, line)
PTR_T mem;
int size;
const char *file;
int line;
{
if (_mtrace_fp == NULL)
_mtrace_fp = stderr;
if (_mtrace_verbose)
fprintf (_mtrace_fp, "free: %p (%d bytes) from '%s:%d'\n",
mem, size, file ? file : "unknown", line);
else
fprintf (_mtrace_fp, "free:%p:%d:%s:%d\n",
mem, size, file ? file : "unknown", line);
}
#endif /* MALLOC_TRACE */
int
malloc_set_trace (n)
int n;
{
int old;
old = malloc_trace;
malloc_trace = n;
_mtrace_verbose = (n > 1);
return old;
}
void
malloc_set_tracefp (fp)
FILE *fp;
{
#ifdef MALLOC_TRACE
_mtrace_fp = fp ? fp : stderr;
#endif
}
void
malloc_trace_bin (n)
int n;
{
#ifdef MALLOC_TRACE
_malloc_trace_buckets[n] = 1;
#endif
}
#define TRACEROOT "/var/tmp/maltrace/trace."
void
malloc_set_tracefn (s, fn)
char *s;
char *fn;
{
#ifdef MALLOC_TRACE
FILE *fp;
char defname[sizeof (TRACEROOT) + 64];
fp = _imalloc_fopen (s, fn, TRACEROOT, defname, sizeof (defname));
if (fp)
malloc_set_tracefp (fp);
#endif
}
+2 -1
View File
@@ -340,7 +340,8 @@ rl_expand_prompt (prompt)
FREE (local_prompt_prefix);
local_prompt = local_prompt_prefix = (char *)0;
prompt_last_invisible = prompt_visible_length = 0;
prompt_last_invisible = prompt_invis_chars_first_line = 0;
prompt_visible_length = prompt_physical_chars = 0;
if (prompt == 0 || *prompt == 0)
return (0);
+6 -5
View File
@@ -883,12 +883,10 @@ rl_redisplay ()
(wrap_offset > visible_wrap_offset) &&
(_rl_last_c_pos < visible_first_line_len))
{
#if defined (HANDLE_MULTIBYTE)
if (MB_CUR_MAX > 1 && rl_byte_oriented == 0)
nleft = _rl_screenwidth - _rl_last_c_pos;
else
#endif
nleft = _rl_screenwidth + wrap_offset - _rl_last_c_pos;
nleft = _rl_screenwidth + wrap_offset - _rl_last_c_pos;
if (nleft)
_rl_clear_to_eol (nleft);
}
@@ -966,8 +964,11 @@ rl_redisplay ()
tx = _rl_col_width (&visible_line[pos], 0, nleft);
else
tx = nleft;
_rl_backspace (_rl_last_c_pos - tx); /* XXX */
_rl_last_c_pos = tx;
if (_rl_last_c_pos != tx)
{
_rl_backspace (_rl_last_c_pos - tx); /* XXX */
_rl_last_c_pos = tx;
}
}
if (MB_CUR_MAX > 1 && rl_byte_oriented == 0)
+2 -2
View File
@@ -127,7 +127,7 @@ putenv (str)
value = name + offset + 1;
/* XXX - should we worry about readonly here? */
var = bind_variable (name, value);
var = bind_variable (name, value, 0);
if (var == 0)
{
errno = EINVAL;
@@ -175,7 +175,7 @@ setenv (name, value, rewrite)
var = find_variable (name);
if (var == 0)
var = bind_variable (name, v);
var = bind_variable (name, v, 0);
if (var == 0)
return -1;