aboutsummaryrefslogtreecommitdiffstats
path: root/util
diff options
context:
space:
mode:
Diffstat (limited to 'util')
-rw-r--r--util/ChangeLog5
-rw-r--r--util/argparse.c12
-rw-r--r--util/dotlock.c24
-rw-r--r--util/fileutil.c16
-rw-r--r--util/http.c42
-rw-r--r--util/iobuf.c100
-rw-r--r--util/logger.c4
-rw-r--r--util/memory.c52
-rw-r--r--util/miscutil.c6
-rw-r--r--util/mkdtemp.c2
-rw-r--r--util/regcomp.c20
-rw-r--r--util/riscos.c20
-rw-r--r--util/secmem.c2
-rw-r--r--util/simple-gettext.c2
-rw-r--r--util/srv.c8
-rw-r--r--util/strgutil.c42
-rw-r--r--util/ttyio.c16
-rw-r--r--util/w32reg.c2
18 files changed, 192 insertions, 183 deletions
diff --git a/util/ChangeLog b/util/ChangeLog
index f04964a83..b2c243c8d 100644
--- a/util/ChangeLog
+++ b/util/ChangeLog
@@ -1,3 +1,8 @@
+2005-07-27 Werner Koch <[email protected]>
+
+ * memory.c (FNAMEX, FNAMEXM): New macros to cope with the now used
+ names xmalloc style names.
+
2005-07-18 Werner Koch <[email protected]>
* ttyio.c (do_get): Move printing of the prompt after disabling
diff --git a/util/argparse.c b/util/argparse.c
index 049eafd9e..63c0e4e88 100644
--- a/util/argparse.c
+++ b/util/argparse.c
@@ -215,7 +215,7 @@ store_alias( ARGPARSE_ARGS *arg, char *name, char *value )
* used as lvalue
*/
#if 0
- ALIAS_DEF a = m_alloc( sizeof *a );
+ ALIAS_DEF a = xmalloc( sizeof *a );
a->name = name;
a->value = value;
a->next = (ALIAS_DEF)arg->internal.aliases;
@@ -310,7 +310,7 @@ optfile_parse( FILE *fp, const char *filename, unsigned *lineno,
trim_spaces( p );
}
if( !p || !*p ) {
- m_free( buffer );
+ xfree( buffer );
arg->r_opt = -10;
}
else {
@@ -324,7 +324,7 @@ optfile_parse( FILE *fp, const char *filename, unsigned *lineno,
char *p;
if( !buffer ) {
keyword[i] = 0;
- buffer = m_strdup(keyword);
+ buffer = xstrdup(keyword);
}
else
buffer[i] = 0;
@@ -346,7 +346,7 @@ optfile_parse( FILE *fp, const char *filename, unsigned *lineno,
}
}
if( !set_opt_arg(arg, opts[idx].flags, p) )
- m_free(buffer);
+ xfree(buffer);
}
break;
}
@@ -401,7 +401,7 @@ optfile_parse( FILE *fp, const char *filename, unsigned *lineno,
buffer[i++] = c;
else {
buflen += 50;
- buffer = m_realloc(buffer, buflen);
+ buffer = xrealloc(buffer, buflen);
buffer[i++] = c;
}
}
@@ -409,7 +409,7 @@ optfile_parse( FILE *fp, const char *filename, unsigned *lineno,
keyword[i++] = c;
else {
buflen = DIM(keyword)+50;
- buffer = m_alloc(buflen);
+ buffer = xmalloc(buflen);
memcpy(buffer, keyword, i);
buffer[i++] = c;
}
diff --git a/util/dotlock.c b/util/dotlock.c
index a7011e3ce..b64458e92 100644
--- a/util/dotlock.c
+++ b/util/dotlock.c
@@ -96,7 +96,7 @@ create_dotlock( const char *file_to_lock )
if( !file_to_lock )
return NULL;
- h = m_alloc_clear( sizeof *h );
+ h = xmalloc_clear( sizeof *h );
if( never_lock ) {
h->disable = 1;
#ifdef _REENTRANT
@@ -142,7 +142,7 @@ create_dotlock( const char *file_to_lock )
h->next = all_lockfiles;
all_lockfiles = h;
- h->tname = m_alloc( dirpartlen + 6+30+ strlen(nodename) + 11 );
+ h->tname = xmalloc( dirpartlen + 6+30+ strlen(nodename) + 11 );
#ifndef __riscos__
sprintf( h->tname, "%.*s/.#lk%p.%s.%d",
dirpartlen, dirpart, h, nodename, (int)getpid() );
@@ -160,8 +160,8 @@ create_dotlock( const char *file_to_lock )
all_lockfiles = h->next;
log_error( "failed to create temporary file `%s': %s\n",
h->tname, strerror(errno));
- m_free(h->tname);
- m_free(h);
+ xfree(h->tname);
+ xfree(h);
return NULL;
}
if( write(fd, pidstr, 11 ) != 11 ) {
@@ -172,8 +172,8 @@ create_dotlock( const char *file_to_lock )
log_fatal( "error writing to `%s': %s\n", h->tname, strerror(errno) );
close(fd);
unlink(h->tname);
- m_free(h->tname);
- m_free(h);
+ xfree(h->tname);
+ xfree(h);
return NULL;
}
if( close(fd) ) {
@@ -183,8 +183,8 @@ create_dotlock( const char *file_to_lock )
#endif
log_error( "error closing `%s': %s\n", h->tname, strerror(errno));
unlink(h->tname);
- m_free(h->tname);
- m_free(h);
+ xfree(h->tname);
+ xfree(h);
return NULL;
}
@@ -192,7 +192,7 @@ create_dotlock( const char *file_to_lock )
/* release mutex */
#endif
#endif
- h->lockname = m_alloc( strlen(file_to_lock) + 6 );
+ h->lockname = xmalloc( strlen(file_to_lock) + 6 );
strcpy(stpcpy(h->lockname, file_to_lock), EXTSEP_S "lock");
return h;
}
@@ -225,10 +225,10 @@ destroy_dotlock ( DOTLOCK h )
unlink (h->lockname);
if (h->tname)
unlink (h->tname);
- m_free (h->tname);
- m_free (h->lockname);
+ xfree (h->tname);
+ xfree (h->lockname);
}
- m_free(h);
+ xfree(h);
}
#endif
diff --git a/util/fileutil.c b/util/fileutil.c
index 4ee94400e..8b23d619b 100644
--- a/util/fileutil.c
+++ b/util/fileutil.c
@@ -50,10 +50,10 @@ make_basename(const char *filepath, const char *inputpath)
if ( !(p=strrchr(filepath, ':')) )
#endif
{
- return m_strdup(filepath);
+ return xstrdup(filepath);
}
- return m_strdup(p+1);
+ return xstrdup(p+1);
}
@@ -77,11 +77,11 @@ make_dirname(const char *filepath)
if ( !(p=strrchr(filepath, ':')) )
#endif
{
- return m_strdup(EXTSEP_S);
+ return xstrdup(EXTSEP_S);
}
dirname_length = p-filepath;
- dirname = m_alloc(dirname_length+1);
+ dirname = xmalloc(dirname_length+1);
strncpy(dirname, filepath, dirname_length);
dirname[dirname_length] = 0;
@@ -114,7 +114,7 @@ make_filename( const char *first_part, ... )
&& (home = getenv("HOME")) && *home )
n += strlen(home);
#endif
- name = m_alloc(n);
+ name = xmalloc(n);
p = home ? stpcpy(stpcpy(name,home), first_part+1)
: stpcpy(name, first_part);
va_start( arg_ptr, first_part ) ;
@@ -126,7 +126,7 @@ make_filename( const char *first_part, ... )
return name;
#else /* __riscos__ */
p = riscos_gstrans(name);
- m_free(name);
+ xfree(name);
return p;
#endif /* __riscos__ */
}
@@ -153,8 +153,8 @@ compare_filenames( const char *a, const char *b )
c = ascii_strcasecmp (abuf, bbuf);
- m_free(abuf);
- m_free(bbuf);
+ xfree(abuf);
+ xfree(bbuf);
return c;
#endif /* __riscos__ */
diff --git a/util/http.c b/util/http.c
index 01e0c6d24..90a6005eb 100644
--- a/util/http.c
+++ b/util/http.c
@@ -125,7 +125,7 @@ make_radix64_string( const byte *data, size_t len )
{
char *buffer, *p;
- buffer = p = m_alloc( (len+2)/3*4 + 1 );
+ buffer = p = xmalloc( (len+2)/3*4 + 1 );
for( ; len >= 3 ; len -= 3, data += 3 ) {
*p++ = bintoasc[(data[0] >> 2) & 077];
*p++ = bintoasc[(((data[0] <<4)&060)|((data[1] >> 4)&017))&077];
@@ -256,7 +256,7 @@ http_close( HTTP_HD hd )
iobuf_close( hd->fp_read );
iobuf_close( hd->fp_write );
release_parsed_uri( hd->uri );
- m_free( hd->buffer );
+ xfree( hd->buffer );
hd->initialized = 0;
}
@@ -270,7 +270,7 @@ http_close( HTTP_HD hd )
static int
parse_uri( PARSED_URI *ret_uri, const char *uri )
{
- *ret_uri = m_alloc_clear( sizeof(**ret_uri) + strlen(uri) );
+ *ret_uri = xmalloc_clear( sizeof(**ret_uri) + strlen(uri) );
strcpy( (*ret_uri)->buffer, uri );
return do_parse_uri( *ret_uri, 0 );
}
@@ -284,9 +284,9 @@ release_parsed_uri( PARSED_URI uri )
for( r = uri->query; r; r = r2 ) {
r2 = r->next;
- m_free( r );
+ xfree( r );
}
- m_free( uri );
+ xfree( uri );
}
}
@@ -483,7 +483,7 @@ parse_tuple( byte *string )
return NULL; /* bad URI */
if( n != strlen( p ) )
return NULL; /* name with a Nul in it */
- tuple = m_alloc_clear( sizeof *tuple );
+ tuple = xmalloc_clear( sizeof *tuple );
tuple->name = p;
if( !p2 ) {
/* we have only the name, so we assume an empty value string */
@@ -492,7 +492,7 @@ parse_tuple( byte *string )
}
else { /* name and value */
if( (n = remove_escapes( p2 )) < 0 ) {
- m_free( tuple );
+ xfree( tuple );
return NULL; /* bad URI */
}
tuple->value = p2;
@@ -536,9 +536,9 @@ send_request( HTTP_HD hd, const char *auth, const char *proxy )
char *x;
remove_escapes(uri->auth);
x=make_radix64_string(uri->auth,strlen(uri->auth));
- proxy_authstr=m_alloc(52+strlen(x));
+ proxy_authstr=xmalloc(52+strlen(x));
sprintf(proxy_authstr,"Proxy-Authorization: Basic %s\r\n",x);
- m_free(x);
+ xfree(x);
}
release_parsed_uri( uri );
@@ -552,7 +552,7 @@ send_request( HTTP_HD hd, const char *auth, const char *proxy )
if(auth)
{
- tempauth=m_strdup(auth);
+ tempauth=xstrdup(auth);
remove_escapes(tempauth);
}
else if(hd->uri->auth)
@@ -560,10 +560,10 @@ send_request( HTTP_HD hd, const char *auth, const char *proxy )
x=make_radix64_string(tempauth?tempauth:hd->uri->auth,
strlen(tempauth?tempauth:hd->uri->auth));
- authstr=m_alloc(52+strlen(x));
+ authstr=xmalloc(52+strlen(x));
sprintf(authstr,"Authorization: Basic %s\r\n",x);
- m_free(x);
- m_free(tempauth);
+ xfree(x);
+ xfree(tempauth);
}
if( hd->sock == -1 )
@@ -571,7 +571,7 @@ send_request( HTTP_HD hd, const char *auth, const char *proxy )
p = build_rel_path( hd->uri );
- request=m_alloc(strlen(server)*2 + strlen(p)
+ request=xmalloc(strlen(server)*2 + strlen(p)
+ (authstr?strlen(authstr):0)
+ (proxy_authstr?strlen(proxy_authstr):0) + 65);
if( proxy )
@@ -596,12 +596,12 @@ send_request( HTTP_HD hd, const char *auth, const char *proxy )
authstr?authstr:"");
}
- m_free(p);
+ xfree(p);
rc = write_server( hd->sock, request, strlen(request) );
- m_free( request );
- m_free(proxy_authstr);
- m_free(authstr);
+ xfree( request );
+ xfree(proxy_authstr);
+ xfree(authstr);
return rc;
}
@@ -630,7 +630,7 @@ build_rel_path( PARSED_URI uri )
n++;
/* now allocate and copy */
- p = rel_path = m_alloc( n );
+ p = rel_path = xmalloc( n );
n = insert_escapes( p, uri->path, "%;?&" );
p += n;
/* todo: add params */
@@ -845,7 +845,7 @@ connect_server( const char *server, ushort port, unsigned int flags,
{
/* Either we're not using SRV, or the SRV lookup failed. Make
up a fake SRV record. */
- srvlist=m_alloc_clear(sizeof(struct srventry));
+ srvlist=xmalloc_clear(sizeof(struct srventry));
srvlist->port=port;
strncpy(srvlist->target,server,MAXDNAME);
srvlist->target[MAXDNAME-1]='\0';
@@ -948,7 +948,7 @@ connect_server( const char *server, ushort port, unsigned int flags,
}
#endif /* !HAVE_GETADDRINFO */
- m_free(srvlist);
+ xfree(srvlist);
if(!connected)
{
diff --git a/util/iobuf.c b/util/iobuf.c
index 324bf075e..2c6259449 100644
--- a/util/iobuf.c
+++ b/util/iobuf.c
@@ -284,7 +284,7 @@ fd_cache_close (const char *fname, FILEP_OR_FD fp)
/* add a new one */
if( DBG_IOBUF )
log_debug ("fd_cache_close (%s) new slot created\n", fname);
- cc = m_alloc_clear (sizeof *cc + strlen (fname));
+ cc = xmalloc_clear (sizeof *cc + strlen (fname));
strcpy (cc->fname, fname);
cc->fp = fp;
cc->next = close_cache;
@@ -409,7 +409,7 @@ file_filter(void *opaque, int control, IOBUF chain, byte *buf, size_t *ret_len)
fclose(f);
}
f = NULL;
- m_free(a); /* we can free our context now */
+ xfree(a); /* we can free our context now */
}
#else /* !stdio implementation */
@@ -531,7 +531,7 @@ file_filter(void *opaque, int control, IOBUF chain, byte *buf, size_t *ret_len)
}
f = INVALID_FP;
#endif
- m_free (a); /* we can free our context now */
+ xfree (a); /* we can free our context now */
}
#endif /* !stdio implementation */
return rc;
@@ -605,7 +605,7 @@ sock_filter (void *opaque, int control, IOBUF chain, byte *buf, size_t *ret_len)
else if ( control == IOBUFCTRL_FREE ) {
if (!a->keep_open)
closesocket (a->sock);
- m_free (a); /* we can free our context now */
+ xfree (a); /* we can free our context now */
}
return rc;
}
@@ -731,7 +731,7 @@ block_filter(void *opaque, int control, IOBUF chain, byte *buf, size_t *ret_len)
if( nbytes < OP_MIN_PARTIAL_CHUNK ) {
/* not enough to write a partial block out; so we store it*/
if( !a->buffer )
- a->buffer = m_alloc( OP_MIN_PARTIAL_CHUNK );
+ a->buffer = xmalloc( OP_MIN_PARTIAL_CHUNK );
memcpy( a->buffer + a->buflen, buf, size );
a->buflen += size;
}
@@ -769,7 +769,7 @@ block_filter(void *opaque, int control, IOBUF chain, byte *buf, size_t *ret_len)
assert( !a->buflen );
assert( nbytes < OP_MIN_PARTIAL_CHUNK );
if( !a->buffer )
- a->buffer = m_alloc( OP_MIN_PARTIAL_CHUNK );
+ a->buffer = xmalloc( OP_MIN_PARTIAL_CHUNK );
memcpy( a->buffer, p, nbytes );
a->buflen = nbytes;
}
@@ -830,7 +830,7 @@ block_filter(void *opaque, int control, IOBUF chain, byte *buf, size_t *ret_len)
log_error("block_filter: write error: %s\n",strerror(errno));
rc = G10ERR_WRITE_FILE;
}
- m_free( a->buffer ); a->buffer = NULL; a->buflen = 0;
+ xfree( a->buffer ); a->buffer = NULL; a->buflen = 0;
}
else
BUG();
@@ -840,7 +840,7 @@ block_filter(void *opaque, int control, IOBUF chain, byte *buf, size_t *ret_len)
}
if( DBG_IOBUF )
log_debug("free block_filter %p\n", a );
- m_free(a); /* we can free our context now */
+ xfree(a); /* we can free our context now */
}
return rc;
@@ -884,9 +884,9 @@ iobuf_alloc(int use, size_t bufsize)
IOBUF a;
static int number=0;
- a = m_alloc_clear(sizeof *a);
+ a = xmalloc_clear(sizeof *a);
a->use = use;
- a->d.buf = m_alloc( bufsize );
+ a->d.buf = xmalloc( bufsize );
a->d.size = bufsize;
a->no = ++number;
a->subno = 0;
@@ -904,7 +904,7 @@ iobuf_close ( IOBUF a )
if( a && a->directfp ) {
fclose( a->directfp );
- m_free( a->real_fname );
+ xfree( a->real_fname );
if( DBG_IOBUF )
log_debug("iobuf_close -> %p\n", a->directfp );
return 0;
@@ -920,12 +920,12 @@ iobuf_close ( IOBUF a )
if( a->filter && (rc = a->filter(a->filter_ov, IOBUFCTRL_FREE,
a->chain, NULL, &dummy_len)) )
log_error("IOBUFCTRL_FREE failed on close: %s\n", g10_errstr(rc) );
- m_free(a->real_fname);
+ xfree(a->real_fname);
if (a->d.buf) {
memset (a->d.buf, 0, a->d.size); /* erase the buffer */
- m_free(a->d.buf);
+ xfree(a->d.buf);
}
- m_free(a);
+ xfree(a);
}
return rc;
}
@@ -944,7 +944,7 @@ iobuf_cancel( IOBUF a )
s = iobuf_get_real_fname(a);
if( s && *s ) {
#if defined(HAVE_DOSISH_SYSTEM) || defined(__riscos__)
- remove_name = m_strdup ( s );
+ remove_name = xstrdup ( s );
#else
remove(s);
#endif
@@ -965,7 +965,7 @@ iobuf_cancel( IOBUF a )
/* Argg, MSDOS does not allow to remove open files. So
* we have to do it here */
remove ( remove_name );
- m_free ( remove_name );
+ xfree ( remove_name );
}
#endif
return rc;
@@ -1063,12 +1063,12 @@ iobuf_open( const char *fname )
else if( (fp = my_fopen_ro(fname, "rb")) == INVALID_FP )
return NULL;
a = iobuf_alloc(1, 8192 );
- fcx = m_alloc( sizeof *fcx + strlen(fname) );
+ fcx = xmalloc( sizeof *fcx + strlen(fname) );
fcx->fp = fp;
fcx->print_only_name = print_only;
strcpy(fcx->fname, fname );
if( !print_only )
- a->real_fname = m_strdup( fname );
+ a->real_fname = xstrdup( fname );
a->filter = file_filter;
a->filter_ov = fcx;
file_filter( fcx, IOBUFCTRL_DESC, NULL, (byte*)&a->desc, &len );
@@ -1099,7 +1099,7 @@ iobuf_fdopen( int fd, const char *mode )
fp = (FILEP_OR_FD)fd;
#endif
a = iobuf_alloc( strchr( mode, 'w')? 2:1, 8192 );
- fcx = m_alloc( sizeof *fcx + 20 );
+ fcx = xmalloc( sizeof *fcx + 20 );
fcx->fp = fp;
fcx->print_only_name = 1;
sprintf(fcx->fname, "[fd %d]", fd );
@@ -1123,7 +1123,7 @@ iobuf_sockopen ( int fd, const char *mode )
size_t len;
a = iobuf_alloc( strchr( mode, 'w')? 2:1, 8192 );
- scx = m_alloc( sizeof *scx + 25 );
+ scx = xmalloc( sizeof *scx + 25 );
scx->sock = fd;
scx->print_only_name = 1;
sprintf(scx->fname, "[sock %d]", fd );
@@ -1166,12 +1166,12 @@ iobuf_create( const char *fname )
else if( (fp = my_fopen(fname, "wb")) == INVALID_FP )
return NULL;
a = iobuf_alloc(2, 8192 );
- fcx = m_alloc( sizeof *fcx + strlen(fname) );
+ fcx = xmalloc( sizeof *fcx + strlen(fname) );
fcx->fp = fp;
fcx->print_only_name = print_only;
strcpy(fcx->fname, fname );
if( !print_only )
- a->real_fname = m_strdup( fname );
+ a->real_fname = xstrdup( fname );
a->filter = file_filter;
a->filter_ov = fcx;
file_filter( fcx, IOBUFCTRL_DESC, NULL, (byte*)&a->desc, &len );
@@ -1201,10 +1201,10 @@ iobuf_append( const char *fname )
else if( !(fp = my_fopen(fname, "ab")) )
return NULL;
a = iobuf_alloc(2, 8192 );
- fcx = m_alloc( sizeof *fcx + strlen(fname) );
+ fcx = xmalloc( sizeof *fcx + strlen(fname) );
fcx->fp = fp;
strcpy(fcx->fname, fname );
- a->real_fname = m_strdup( fname );
+ a->real_fname = xstrdup( fname );
a->filter = file_filter;
a->filter_ov = fcx;
file_filter( fcx, IOBUFCTRL_DESC, NULL, (byte*)&a->desc, &len );
@@ -1229,10 +1229,10 @@ iobuf_openrw( const char *fname )
else if( (fp = my_fopen(fname, "r+b")) == INVALID_FP )
return NULL;
a = iobuf_alloc(2, 8192 );
- fcx = m_alloc( sizeof *fcx + strlen(fname) );
+ fcx = xmalloc( sizeof *fcx + strlen(fname) );
fcx->fp = fp;
strcpy(fcx->fname, fname );
- a->real_fname = m_strdup( fname );
+ a->real_fname = xstrdup( fname );
a->filter = file_filter;
a->filter_ov = fcx;
file_filter( fcx, IOBUFCTRL_DESC, NULL, (byte*)&a->desc, &len );
@@ -1330,12 +1330,12 @@ iobuf_push_filter2( IOBUF a,
* The contents of the buffers are transferred to the
* new stream.
*/
- b = m_alloc(sizeof *b);
+ b = xmalloc(sizeof *b);
memcpy(b, a, sizeof *b );
/* fixme: it is stupid to keep a copy of the name at every level
* but we need the name somewhere because the name known by file_filter
* may have been released when we need the name of the file */
- b->real_fname = a->real_fname? m_strdup(a->real_fname):NULL;
+ b->real_fname = a->real_fname? xstrdup(a->real_fname):NULL;
/* remove the filter stuff from the new stream */
a->filter = NULL;
a->filter_ov = NULL;
@@ -1345,12 +1345,12 @@ iobuf_push_filter2( IOBUF a,
a->use = 2; /* make a write stream from a temp stream */
if( a->use == 2 ) { /* allocate a fresh buffer for the original stream */
- b->d.buf = m_alloc( a->d.size );
+ b->d.buf = xmalloc( a->d.size );
b->d.len = 0;
b->d.start = 0;
}
else { /* allocate a fresh buffer for the new stream */
- a->d.buf = m_alloc( a->d.size );
+ a->d.buf = xmalloc( a->d.size );
a->d.len = 0;
a->d.start = 0;
}
@@ -1401,10 +1401,10 @@ pop_filter( IOBUF a, int (*f)(void *opaque, int control,
if( !a->filter ) { /* this is simple */
b = a->chain;
assert(b);
- m_free(a->d.buf);
- m_free(a->real_fname);
+ xfree(a->d.buf);
+ xfree(a->real_fname);
memcpy(a,b, sizeof *a);
- m_free(b);
+ xfree(b);
return 0;
}
for(b=a ; b; b = b->chain )
@@ -1425,7 +1425,7 @@ pop_filter( IOBUF a, int (*f)(void *opaque, int control,
return rc;
}
if( b->filter_ov && b->filter_ov_owner ) {
- m_free( b->filter_ov );
+ xfree( b->filter_ov );
b->filter_ov = NULL;
}
@@ -1438,10 +1438,10 @@ pop_filter( IOBUF a, int (*f)(void *opaque, int control,
* a flush has been done on the to be removed entry
*/
b = a->chain;
- m_free(a->d.buf);
- m_free(a->real_fname);
+ xfree(a->d.buf);
+ xfree(a->real_fname);
memcpy(a,b, sizeof *a);
- m_free(b);
+ xfree(b);
if( DBG_IOBUF )
log_debug("iobuf-%d.%d: popped filter\n", a->no, a->subno );
}
@@ -1476,10 +1476,10 @@ underflow(IOBUF a)
if( DBG_IOBUF )
log_debug("iobuf-%d.%d: pop `%s' in underflow\n",
a->no, a->subno, a->desc );
- m_free(a->d.buf);
- m_free(a->real_fname);
+ xfree(a->d.buf);
+ xfree(a->real_fname);
memcpy(a, b, sizeof *a);
- m_free(b);
+ xfree(b);
print_chain(a);
}
else
@@ -1530,7 +1530,7 @@ underflow(IOBUF a)
NULL, &dummy_len)) )
log_error("IOBUFCTRL_FREE failed: %s\n", g10_errstr(rc) );
if( a->filter_ov && a->filter_ov_owner ) {
- m_free( a->filter_ov );
+ xfree( a->filter_ov );
a->filter_ov = NULL;
}
a->filter = NULL;
@@ -1542,10 +1542,10 @@ underflow(IOBUF a)
if( DBG_IOBUF )
log_debug("iobuf-%d.%d: pop `%s' in underflow (!len)\n",
a->no, a->subno, a->desc );
- m_free(a->d.buf);
- m_free(a->real_fname);
+ xfree(a->d.buf);
+ xfree(a->real_fname);
memcpy(a,b, sizeof *a);
- m_free(b);
+ xfree(b);
print_chain(a);
}
}
@@ -1586,9 +1586,9 @@ iobuf_flush(IOBUF a)
if( DBG_IOBUF )
log_debug("increasing temp iobuf from %lu to %lu\n",
(ulong)a->d.size, (ulong)newsize );
- newbuf = m_alloc( newsize );
+ newbuf = xmalloc( newsize );
memcpy( newbuf, a->d.buf, a->d.len );
- m_free(a->d.buf);
+ xfree(a->d.buf);
a->d.buf = newbuf;
a->d.size = newsize;
return 0;
@@ -1624,7 +1624,7 @@ iobuf_readbyte(IOBUF a)
if( a->unget.buf ) {
if( a->unget.start < a->unget.len )
return a->unget.buf[a->unget.start++];
- m_free(a->unget.buf);
+ xfree(a->unget.buf);
a->unget.buf = NULL;
a->nofast &= ~2;
}
@@ -2042,7 +2042,7 @@ iobuf_get_fname( IOBUF a )
void
iobuf_set_partial_block_mode( IOBUF a, size_t len )
{
- block_filter_ctx_t *ctx = m_alloc_clear( sizeof *ctx );
+ block_filter_ctx_t *ctx = xmalloc_clear( sizeof *ctx );
assert( a->use == 1 || a->use == 2 );
ctx->use = a->use;
@@ -2084,7 +2084,7 @@ iobuf_read_line( IOBUF a, byte **addr_of_buffer,
if( !buffer ) { /* must allocate a new buffer */
length = 256;
- buffer = m_alloc( length );
+ buffer = xmalloc( length );
*addr_of_buffer = buffer;
*length_of_buffer = length;
}
@@ -2104,7 +2104,7 @@ iobuf_read_line( IOBUF a, byte **addr_of_buffer,
}
length += 3; /* correct for the reserved byte */
length += length < 1024? 256 : 1024;
- buffer = m_realloc( buffer, length );
+ buffer = xrealloc( buffer, length );
*addr_of_buffer = buffer;
*length_of_buffer = length;
length -= 3; /* and reserve again */
diff --git a/util/logger.c b/util/logger.c
index 9326a4659..857436c43 100644
--- a/util/logger.c
+++ b/util/logger.c
@@ -71,9 +71,9 @@ log_stream()
void
log_set_name( const char *name )
{
- m_free(pgm_name);
+ xfree(pgm_name);
if( name )
- pgm_name = m_strdup(name);
+ pgm_name = xstrdup(name);
else
pgm_name = NULL;
}
diff --git a/util/memory.c b/util/memory.c
index 35b37cfbc..dd7fc833a 100644
--- a/util/memory.c
+++ b/util/memory.c
@@ -63,15 +63,17 @@
#ifndef M_GUARD
#define M_GUARD 1
#endif
-#undef m_alloc
-#undef m_alloc_clear
-#undef m_alloc_secure
-#undef m_alloc_secure_clear
-#undef m_realloc
-#undef m_free
+#undef xmalloc
+#undef xmalloc_clear
+#undef xmalloc_secure
+#undef xmalloc_secure_clear
+#undef xrealloc
+#undef xfree
#undef m_check
-#undef m_strdup
-#define FNAME(a) m_debug_ ##a
+#undef xstrdup
+#define FNAME(a) m_debug_ ##a
+#define FNAMEX(a) m_debug_ ##a
+#define FNAMEXM(a) m_debug_ ##a
#define FNAMEPRT , const char *info
#define FNAMEARG , info
#ifndef __riscos__
@@ -82,7 +84,9 @@
info, __func__ ); } while(0)
#endif
#else
-#define FNAME(a) m_ ##a
+#define FNAME(a) m_ ##a
+#define FNAMEX(a) x ##a
+#define FNAMEXM(a) xm ##a
#define FNAMEPRT
#define FNAMEARG
#define store_len(p,n,m) do { ((byte*)p)[EXTRA_ALIGN+0] = n; \
@@ -418,7 +422,7 @@ out_of_core(size_t n, int secure)
* This function gives up if we do not have enough memory
*/
void *
-FNAME(alloc)( size_t n FNAMEPRT )
+FNAMEXM(alloc)( size_t n FNAMEPRT )
{
char *p;
@@ -447,7 +451,7 @@ FNAME(alloc)( size_t n FNAMEPRT )
* This function gives up if we do not have enough memory
*/
void *
-FNAME(alloc_secure)( size_t n FNAMEPRT )
+FNAMEXM(alloc_secure)( size_t n FNAMEPRT )
{
char *p;
@@ -471,19 +475,19 @@ FNAME(alloc_secure)( size_t n FNAMEPRT )
}
void *
-FNAME(alloc_clear)( size_t n FNAMEPRT )
+FNAMEXM(alloc_clear)( size_t n FNAMEPRT )
{
void *p;
- p = FNAME(alloc)( n FNAMEARG );
+ p = FNAMEXM(alloc)( n FNAMEARG );
memset(p, 0, n );
return p;
}
void *
-FNAME(alloc_secure_clear)( size_t n FNAMEPRT)
+FNAMEXM(alloc_secure_clear)( size_t n FNAMEPRT)
{
void *p;
- p = FNAME(alloc_secure)( n FNAMEARG );
+ p = FNAMEXM(alloc_secure)( n FNAMEARG );
memset(p, 0, n );
return p;
}
@@ -493,7 +497,7 @@ FNAME(alloc_secure_clear)( size_t n FNAMEPRT)
* realloc and clear the old space
*/
void *
-FNAME(realloc)( void *a, size_t n FNAMEPRT )
+FNAMEX(realloc)( void *a, size_t n FNAMEPRT )
{
void *b;
@@ -516,7 +520,7 @@ FNAME(realloc)( void *a, size_t n FNAMEPRT )
b = FNAME(alloc)(n FNAMEARG);
#else
if( m_is_secure(a) ) {
- if( !(b = secmem_realloc( a, n )) )
+ if( !(b = secmexrealloc( a, n )) )
out_of_core(n,1);
}
else {
@@ -534,7 +538,7 @@ FNAME(realloc)( void *a, size_t n FNAMEPRT )
* Free a pointer
*/
void
-FNAME(free)( void *a FNAMEPRT )
+FNAMEX(free)( void *a FNAMEPRT )
{
byte *p = a;
@@ -605,16 +609,16 @@ m_size( const void *a )
char *
-FNAME(strdup)( const char *a FNAMEPRT )
+FNAMEX(strdup)( const char *a FNAMEPRT )
{
size_t n = strlen(a);
- char *p = FNAME(alloc)(n+1 FNAMEARG);
+ char *p = FNAMEXM(alloc)(n+1 FNAMEARG);
strcpy(p, a);
return p;
}
-/* Wrapper around m_alloc_clear to take the usual 2 arguments of a
+/* Wrapper around xmalloc_clear to take the usual 2 arguments of a
calloc style function. */
void *
xcalloc (size_t n, size_t m)
@@ -624,10 +628,10 @@ xcalloc (size_t n, size_t m)
nbytes = n * m;
if (m && nbytes / m != n)
out_of_core (nbytes, 0);
- return m_alloc_clear (nbytes);
+ return xmalloc_clear (nbytes);
}
-/* Wrapper around m_alloc_csecure_lear to take the usual 2 arguments
+/* Wrapper around xmalloc_csecure_lear to take the usual 2 arguments
of a calloc style function. */
void *
xcalloc_secure (size_t n, size_t m)
@@ -637,6 +641,6 @@ xcalloc_secure (size_t n, size_t m)
nbytes = n * m;
if (m && nbytes / m != n)
out_of_core (nbytes, 1);
- return m_alloc_secure_clear (nbytes);
+ return xmalloc_secure_clear (nbytes);
}
diff --git a/util/miscutil.c b/util/miscutil.c
index 92dde404c..98c2e8d62 100644
--- a/util/miscutil.c
+++ b/util/miscutil.c
@@ -255,7 +255,7 @@ print_utf8_string2 ( FILE *fp, const byte *p, size_t n, int delim )
buf = utf8_to_native ( p, n, delim );
/*(utf8 conversion already does the control character quoting)*/
fputs( buf, fp );
- m_free( buf );
+ xfree( buf );
}
else
print_string( fp, p, n, delim );
@@ -269,7 +269,7 @@ print_utf8_string( FILE *fp, const byte *p, size_t n )
/****************
* This function returns a string which is suitable for printing
- * Caller must release it with m_free()
+ * Caller must release it with xfree()
*/
char *
make_printable_string( const byte *p, size_t n, int delim )
@@ -294,7 +294,7 @@ make_printable_string( const byte *p, size_t n, int delim )
p = save_p;
n = save_n;
/* and now make the string */
- d = buffer = m_alloc( buflen );
+ d = buffer = xmalloc( buflen );
for( ; n; n--, p++ ) {
if( *p < 0x20 || (*p >= 0x7f && *p < 0xa0) || *p == delim ||
(delim && *p=='\\')) {
diff --git a/util/mkdtemp.c b/util/mkdtemp.c
index c8b67db5a..25ace4fc5 100644
--- a/util/mkdtemp.c
+++ b/util/mkdtemp.c
@@ -86,7 +86,7 @@ char *mkdtemp(char *template)
if(remaining>0)
sprintf(marker,"%X",randombits[idx]&0xF);
- m_free(randombits);
+ xfree(randombits);
if(mkdir(template,0700)==0)
break;
diff --git a/util/regcomp.c b/util/regcomp.c
index 28b54a97e..766339945 100644
--- a/util/regcomp.c
+++ b/util/regcomp.c
@@ -138,7 +138,7 @@ static reg_errcode_t build_range_exp (re_bitset_ptr_t sbcset,
bracket_elem_t *end_elem);
static reg_errcode_t build_collating_symbol (re_bitset_ptr_t sbcset,
re_charset_t *mbcset,
- int *coll_sym_alloc,
+ int *coll_syxmalloc,
const unsigned char *name);
# else /* not RE_ENABLE_I18N */
static reg_errcode_t build_range_exp (re_bitset_ptr_t sbcset,
@@ -2419,9 +2419,9 @@ build_range_exp (sbcset, start_elem, end_elem)
static reg_errcode_t
# ifdef RE_ENABLE_I18N
-build_collating_symbol (sbcset, mbcset, coll_sym_alloc, name)
+build_collating_symbol (sbcset, mbcset, coll_syxmalloc, name)
re_charset_t *mbcset;
- int *coll_sym_alloc;
+ int *coll_syxmalloc;
# else /* not RE_ENABLE_I18N */
build_collating_symbol (sbcset, name)
# endif /* not RE_ENABLE_I18N */
@@ -2649,9 +2649,9 @@ parse_bracket_exp (regexp, dfa, token, syntax, err)
static inline reg_errcode_t
# ifdef RE_ENABLE_I18N
- build_collating_symbol (sbcset, mbcset, coll_sym_alloc, name)
+ build_collating_symbol (sbcset, mbcset, coll_syxmalloc, name)
re_charset_t *mbcset;
- int *coll_sym_alloc;
+ int *coll_syxmalloc;
# else /* not RE_ENABLE_I18N */
build_collating_symbol (sbcset, name)
# endif /* not RE_ENABLE_I18N */
@@ -2683,15 +2683,15 @@ parse_bracket_exp (regexp, dfa, token, syntax, err)
# ifdef RE_ENABLE_I18N
/* Got valid collation sequence, add it as a new entry. */
/* Check the space of the arrays. */
- if (*coll_sym_alloc == mbcset->ncoll_syms)
+ if (*coll_syxmalloc == mbcset->ncoll_syms)
{
/* Not enough, realloc it. */
/* +1 in case of mbcset->ncoll_syms is 0. */
- *coll_sym_alloc = 2 * mbcset->ncoll_syms + 1;
+ *coll_syxmalloc = 2 * mbcset->ncoll_syms + 1;
/* Use realloc since mbcset->coll_syms is NULL
if *alloc == 0. */
mbcset->coll_syms = re_realloc (mbcset->coll_syms, int32_t,
- *coll_sym_alloc);
+ *coll_syxmalloc);
if (BE (mbcset->coll_syms == NULL, 0))
return REG_ESPACE;
}
@@ -2716,7 +2716,7 @@ parse_bracket_exp (regexp, dfa, token, syntax, err)
re_bitset_ptr_t sbcset;
#ifdef RE_ENABLE_I18N
re_charset_t *mbcset;
- int coll_sym_alloc = 0, range_alloc = 0, mbchar_alloc = 0;
+ int coll_syxmalloc = 0, range_alloc = 0, mbchar_alloc = 0;
int equiv_class_alloc = 0, char_class_alloc = 0;
#else /* not RE_ENABLE_I18N */
int non_match = 0;
@@ -2893,7 +2893,7 @@ parse_bracket_exp (regexp, dfa, token, syntax, err)
case COLL_SYM:
*err = build_collating_symbol (sbcset,
#ifdef RE_ENABLE_I18N
- mbcset, &coll_sym_alloc,
+ mbcset, &coll_syxmalloc,
#endif /* RE_ENABLE_I18N */
start_elem.opr.name);
if (BE (*err != REG_NOERROR, 0))
diff --git a/util/riscos.c b/util/riscos.c
index c4240c8ba..b94ff5318 100644
--- a/util/riscos.c
+++ b/util/riscos.c
@@ -238,7 +238,7 @@ riscos_fdopenfile(const char *filename, const int allow_write)
}
h = fds_list;
- fds_list = (struct fds_item *) m_alloc(sizeof(struct fds_item));
+ fds_list = (struct fds_item *) xmalloc(sizeof(struct fds_item));
if (!fds_list)
log_fatal("Can't claim memory for fdopenfile() buffer!\n");
fds_list->fd = fd;
@@ -258,7 +258,7 @@ riscos_close_fds(void)
if (fp)
fflush(fp);
close(fds_list->fd);
- m_free(fds_list);
+ xfree(fds_list);
fds_list = h;
}
}
@@ -285,20 +285,20 @@ riscos_gstrans(const char *old)
int size = 256, last;
char *buf, *tmp;
- buf = (char *) m_alloc(size);
+ buf = (char *) xmalloc(size);
if (!buf)
log_fatal("Can't claim memory for OS_GSTrans buffer!\n");
while (_C & _swi(OS_GSTrans, _INR(0,2) | _OUT(2) | _RETURN(_FLAGS),
old, buf, size, &last)) {
size += 256;
- tmp = (char *) m_realloc(buf, size);
+ tmp = (char *) xrealloc(buf, size);
if (!tmp)
log_fatal("Can't claim memory for OS_GSTrans buffer!\n");
buf = tmp;
}
buf[last] = '\0';
- tmp = (char *) m_realloc(buf, last + 1);
+ tmp = (char *) xrealloc(buf, last + 1);
if (!tmp)
log_fatal("Can't realloc memory after OS_GSTrans!\n");
@@ -323,7 +323,7 @@ riscos_make_basename(const char *filepath, const char *realfname)
p = (char*) filepath;
i = strlen(p);
- result = m_alloc(i + 5);
+ result = xmalloc(i + 5);
if (!result)
log_fatal("Can't claim memory for riscos_make_basename() buffer!\n");
strcpy(result, p);
@@ -405,24 +405,24 @@ riscos_list_openfiles(void)
if (_swix(OS_Args, _INR(0,2) | _IN(5) | _OUT(5), 7, i, 0, 0, &len))
continue;
- name = (char *) m_alloc(1-len);
+ name = (char *) xmalloc(1-len);
if (!name)
log_fatal("Can't claim memory for OS_Args buffer!\n");
if (_swix(OS_Args, _INR(0,2) | _IN(5), 7, i, name, 1-len)) {
- m_free(name);
+ xfree(name);
log_fatal("Error when calling OS_Args(7)!\n");
}
if (_swix(OS_Args, _INR(0,1) | _OUT(0), 254, i, &len)) {
- m_free(name);
+ xfree(name);
log_fatal("Error when calling OS_Args(254)!\n");
}
printf("%3i: %s (%c%c)\n", i, name,
(len & 0x40) ? 'R' : 0,
(len & 0x80) ? 'W' : 0);
- m_free(name);
+ xfree(name);
}
}
#endif
diff --git a/util/secmem.c b/util/secmem.c
index 10f6052ab..8ab33e1d1 100644
--- a/util/secmem.c
+++ b/util/secmem.c
@@ -394,7 +394,7 @@ secmem_malloc( size_t size )
void *
-secmem_realloc( void *p, size_t newsize )
+secmexrealloc( void *p, size_t newsize )
{
MEMBLOCK *mb;
size_t size;
diff --git a/util/simple-gettext.c b/util/simple-gettext.c
index 483f293b4..3249775bf 100644
--- a/util/simple-gettext.c
+++ b/util/simple-gettext.c
@@ -362,7 +362,7 @@ get_string( struct loaded_domain *domain, u32 idx )
else
p = "ERROR in GETTEXT MALLOC";
}
- m_free (buf);
+ xfree (buf);
}
else if (domain->mapped[idx] == 2)
{ /* We need to get the string from the overflow_space. */
diff --git a/util/srv.c b/util/srv.c
index 75424d91d..a00119dde 100644
--- a/util/srv.c
+++ b/util/srv.c
@@ -89,7 +89,7 @@ getsrv(const char *name,struct srventry **list)
struct srventry *srv=NULL;
u16 type,class;
- *list=m_realloc(*list,(srvcount+1)*sizeof(struct srventry));
+ *list=xrealloc(*list,(srvcount+1)*sizeof(struct srventry));
memset(&(*list)[srvcount],0,sizeof(struct srventry));
srv=&(*list)[srvcount];
srvcount++;
@@ -216,12 +216,12 @@ getsrv(const char *name,struct srventry **list)
return srvcount;
noanswer:
- m_free(*list);
+ xfree(*list);
*list=NULL;
return 0;
fail:
- m_free(*list);
+ xfree(*list);
*list=NULL;
return -1;
}
@@ -246,7 +246,7 @@ main(int argc,char *argv[])
printf("\n");
}
- m_free(srv);
+ xfree(srv);
return 0;
}
diff --git a/util/strgutil.c b/util/strgutil.c
index 58f5b0b50..cffdfcf77 100644
--- a/util/strgutil.c
+++ b/util/strgutil.c
@@ -168,7 +168,7 @@ free_strlist( STRLIST sl )
for(; sl; sl = sl2 ) {
sl2 = sl->next;
- m_free(sl);
+ xfree(sl);
}
}
@@ -178,7 +178,7 @@ add_to_strlist( STRLIST *list, const char *string )
{
STRLIST sl;
- sl = m_alloc( sizeof *sl + strlen(string));
+ sl = xmalloc( sizeof *sl + strlen(string));
sl->flags = 0;
strcpy(sl->d, string);
sl->next = *list;
@@ -200,7 +200,7 @@ add_to_strlist2( STRLIST *list, const char *string, int is_utf8 )
else {
char *p = native_to_utf8( string );
sl = add_to_strlist( list, p );
- m_free( p );
+ xfree( p );
}
return sl;
}
@@ -210,7 +210,7 @@ append_to_strlist( STRLIST *list, const char *string )
{
STRLIST r, sl;
- sl = m_alloc( sizeof *sl + strlen(string));
+ sl = xmalloc( sizeof *sl + strlen(string));
sl->flags = 0;
strcpy(sl->d, string);
sl->next = NULL;
@@ -234,7 +234,7 @@ append_to_strlist2( STRLIST *list, const char *string, int is_utf8 )
else {
char *p = native_to_utf8( string );
sl = append_to_strlist( list, p );
- m_free( p );
+ xfree( p );
}
return sl;
}
@@ -267,11 +267,11 @@ pop_strlist( STRLIST *list )
if(sl)
{
- str=m_alloc(strlen(sl->d)+1);
+ str=xmalloc(strlen(sl->d)+1);
strcpy(str,sl->d);
*list=sl->next;
- m_free(sl);
+ xfree(sl);
}
return str;
@@ -323,7 +323,7 @@ ascii_memistr( const char *buf, size_t buflen, const char *sub )
/* Like strncpy() but copy at max N-1 bytes and append a '\0'. With
* N given as 0 nothing is copied at all. With DEST given as NULL
- * sufficient memory is allocated using m_alloc (note that m_alloc is
+ * sufficient memory is allocated using xmalloc (note that xmalloc is
* guaranteed to succeed or to abort the process). */
char *
mem2str( char *dest , const void *src , size_t n )
@@ -333,7 +333,7 @@ mem2str( char *dest , const void *src , size_t n )
if( n ) {
if( !dest )
- dest = m_alloc( n ) ;
+ dest = xmalloc( n ) ;
d = dest;
s = src ;
for(n--; n && *s; n-- )
@@ -677,7 +677,7 @@ native_to_utf8( const char *string )
if (no_translation)
{ /* Already utf-8 encoded. */
- buffer = m_strdup (string);
+ buffer = xstrdup (string);
}
else if( !active_charset && !use_iconv) /* Shortcut implementation
for Latin-1. */
@@ -688,7 +688,7 @@ native_to_utf8( const char *string )
if( *s & 0x80 )
length++;
}
- buffer = m_alloc( length + 1 );
+ buffer = xmalloc( length + 1 );
for(p=buffer, s=string; *s; s++ )
{
if( *s & 0x80 )
@@ -722,7 +722,7 @@ native_to_utf8( const char *string )
if ((*s & 0x80))
length += 5; /* We may need up to 6 bytes for the utf8 output. */
}
- buffer = m_alloc (length + 1);
+ buffer = xmalloc (length + 1);
inptr = string;
inbytes = strlen (string);
@@ -756,7 +756,7 @@ native_to_utf8( const char *string )
if( *s & 0x80 )
length += 2; /* We may need up to 3 bytes. */
}
- buffer = m_alloc( length + 1 );
+ buffer = xmalloc( length + 1 );
for(p=buffer, s=string; *s; s++ ) {
if( *s & 0x80 ) {
ushort val = active_charset[ *s & 0x7f ];
@@ -978,7 +978,7 @@ utf8_to_native( const char *string, size_t length, int delim )
}
}
if( !buffer ) { /* allocate the buffer after the first pass */
- buffer = p = m_alloc( n + 1 );
+ buffer = p = xmalloc( n + 1 );
}
#ifdef USE_GNUPG_ICONV
else if(use_iconv) {
@@ -994,7 +994,7 @@ utf8_to_native( const char *string, size_t length, int delim )
if (cd == (iconv_t)-1)
{
handle_iconv_error (active_charset_name, "utf-8", 1);
- m_free (buffer);
+ xfree (buffer);
return utf8_to_native (string, length, delim);
}
@@ -1006,7 +1006,7 @@ utf8_to_native( const char *string, size_t length, int delim )
outbytes = n * MB_LEN_MAX;
if (outbytes / MB_LEN_MAX != n)
BUG (); /* Actually an overflow. */
- outbuf = outptr = m_alloc (outbytes);
+ outbuf = outptr = xmalloc (outbytes);
if ( iconv (cd, (ICONV_CONST char **)&inptr, &inbytes,
&outptr, &outbytes) == (size_t)-1) {
static int shown;
@@ -1017,9 +1017,9 @@ utf8_to_native( const char *string, size_t length, int delim )
shown = 1;
/* Didn't worked out. Temporary disable the use of
* iconv and fall back to our old code. */
- m_free (buffer);
+ xfree (buffer);
buffer = NULL;
- m_free (outbuf);
+ xfree (outbuf);
use_iconv = 0;
outbuf = utf8_to_native (string, length, delim);
use_iconv = 1;
@@ -1029,7 +1029,7 @@ utf8_to_native( const char *string, size_t length, int delim )
/* We could realloc the buffer now but I doubt that it makes
much sense given that it will get freed anyway soon
after. */
- m_free (buffer);
+ xfree (buffer);
}
iconv_close (cd);
return outbuf;
@@ -1251,7 +1251,7 @@ strncasecmp( const char *a, const char *b, size_t n )
#ifdef _WIN32
/*
* Like vsprintf but provides a pointer to malloc'd storage, which
- * must be freed by the caller (m_free). Taken from libiberty as
+ * must be freed by the caller (xfree). Taken from libiberty as
* found in gcc-2.95.2 and a little bit modernized.
* FIXME: Write a new CRT for W32.
*/
@@ -1335,7 +1335,7 @@ vasprintf (char **result, const char *format, va_list args)
}
}
}
- *result = m_alloc (total_width);
+ *result = xmalloc (total_width);
if (*result != NULL)
return vsprintf (*result, format, args);
else
diff --git a/util/ttyio.c b/util/ttyio.c
index d1d4ca2fa..63a68a380 100644
--- a/util/ttyio.c
+++ b/util/ttyio.c
@@ -238,7 +238,7 @@ tty_printf( const char *fmt, ... )
if( n != nwritten )
log_fatal ("WriteConsole failed: %d != %d\n", n, (int)nwritten );
last_prompt_len += n;
- m_free (buf);
+ xfree (buf);
}
#else
last_prompt_len += vfprintf(ttyfp,fmt,arg_ptr) ;
@@ -357,7 +357,7 @@ tty_print_utf8_string2 (const byte *p, size_t n, size_t max_n )
}
/*(utf8 conversion already does the control character quoting)*/
tty_printf("%s", buf );
- m_free( buf );
+ xfree( buf );
}
else {
if( max_n && (n > max_n) ) {
@@ -397,7 +397,7 @@ do_get( const char *prompt, int hidden )
init_ttyfp();
last_prompt_len = 0;
- buf = m_alloc(n=50);
+ buf = xmalloc(n=50);
i = 0;
#ifdef _WIN32 /* windoze version */
@@ -428,7 +428,7 @@ do_get( const char *prompt, int hidden )
continue;
if( !(i < n-1) ) {
n += 50;
- buf = m_realloc( buf, n );
+ buf = xrealloc( buf, n );
}
buf[i++] = c;
}
@@ -467,7 +467,7 @@ do_get( const char *prompt, int hidden )
}
if(!(i < n-1)) {
n += 50;
- buf = m_realloc(buf, n);
+ buf = xrealloc(buf, n);
}
buf[i++] = c;
if (!hidden) {
@@ -511,7 +511,7 @@ do_get( const char *prompt, int hidden )
continue;
if( !(i < n-1) ) {
n += 50;
- buf = m_realloc( buf, n );
+ buf = xrealloc( buf, n );
}
buf[i++] = c;
}
@@ -552,7 +552,7 @@ tty_get( const char *prompt )
/* We need to copy it to memory controlled by our malloc
implementations; further we need to convert an EOF to our
convention. */
- buf = m_alloc(line? strlen(line)+1:2);
+ buf = xmalloc(line? strlen(line)+1:2);
if (line)
{
strcpy (buf, line);
@@ -616,6 +616,6 @@ tty_get_answer_is_yes( const char *prompt )
char *p = tty_get( prompt );
tty_kill_prompt();
yes = answer_is_yes(p);
- m_free(p);
+ xfree(p);
return yes;
}
diff --git a/util/w32reg.c b/util/w32reg.c
index 73732e032..f65c9542c 100644
--- a/util/w32reg.c
+++ b/util/w32reg.c
@@ -62,7 +62,7 @@ get_root_key(const char *root)
* error. Caller must release the return value. A NULL for root
* is an alias for HKEY_CURRENT_USER, HKEY_LOCAL_MACHINE in turn.
* NOTE: The value is allocated with a plain malloc() - use free() and not
- * the usual m_free()!!!
+ * the usual xfree()!!!
*/
char *
read_w32_registry_string( const char *root, const char *dir, const char *name )