Skip to content

Commit 36e32a2

Browse files
Rename safe{malloc,realloc} to safe_{malloc,realloc}
1 parent dd84b51 commit 36e32a2

File tree

6 files changed

+10
-10
lines changed

6 files changed

+10
-10
lines changed

config/include/config/config2.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@
1616

1717
#ifdef USE_DEBUGGING_MALLOC
1818
# include "malloc.h"
19-
# define safemalloc malloc
20-
# define saferealloc realloc
19+
# define safe_malloc malloc
20+
# define safe_realloc realloc
2121
#endif
2222

2323
#include <string.h>

libtrn/edit_dist.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
#include "config/common.h" /* Declare MemorySize */
99
#include "trn/edit_dist.h"
1010

11-
#include "trn/util.h" /* Declare safemalloc() */
11+
#include "trn/util.h" /* Declare safe_malloc() */
1212

1313
#include <algorithm>
1414
#include <cstdlib>

libtrn/rcln.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -353,7 +353,7 @@ void sub_art_num(DTASRC *dp, ART_NUM artnum, char *ngnam)
353353
artnum = 0;
354354
}
355355
*(np->rcline + np->numoffset - 1) = np->subscribechar;
356-
mbuf = safemalloc((MemorySize)(curlen+(artnum?(MAX_DIGITS+1)*2+1:1+1)));
356+
mbuf = safe_malloc((MemorySize)(curlen+(artnum?(MAX_DIGITS+1)*2+1:1+1)));
357357
*s = '\0';
358358
std::strcpy(mbuf,np->rcline); /* make new rc line */
359359
s = mbuf + (s - np->rcline);

libtrn/sacmd.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -629,7 +629,7 @@ int sa_do_cmd()
629629
}
630630
if (!sa_extracted_use)
631631
{
632-
sa_extracted_use = safemalloc(LBUFLEN);
632+
sa_extracted_use = safe_malloc(LBUFLEN);
633633
/* later consider a variable for the default command */
634634
*sa_extracted_use = '\0';
635635
}
@@ -650,7 +650,7 @@ int sa_do_cmd()
650650
}
651651
if (s_sa_extract_dest == nullptr)
652652
{
653-
s_sa_extract_dest = (char*)safemalloc(LBUFLEN);
653+
s_sa_extract_dest = (char*)safe_malloc(LBUFLEN);
654654
safecpy(s_sa_extract_dest,filexp("%p"),LBUFLEN);
655655
}
656656
if (*decode_dest != '/' && *decode_dest != '~' && *decode_dest != '%')

libtrn/terminal.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -394,7 +394,7 @@ void term_set(char *tcbuf)
394394
{
395395
if (tgetflag("nc") && *g_tc_UP)
396396
{
397-
g_tc_CR = safemalloc((MemorySize)std::strlen(g_tc_UP)+2);
397+
g_tc_CR = safe_malloc((MemorySize)std::strlen(g_tc_UP)+2);
398398
std::sprintf(g_tc_CR,"%s\r",g_tc_UP);
399399
}
400400
else

util/env.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -496,7 +496,7 @@ char *export_var(const char *nam, const char *val)
496496
{
497497
#ifndef lint
498498
char** tmpenv = (char**) /* point our wand at memory */
499-
safemalloc((MemorySize) (i+2) * sizeof(char*));
499+
safe_malloc((MemorySize) (i+2) * sizeof(char*));
500500
#else
501501
char** tmpenv = nullptr;
502502
#endif /* lint */
@@ -511,14 +511,14 @@ char *export_var(const char *nam, const char *val)
511511
#ifndef lint
512512
else
513513
{
514-
environ = (char**) saferealloc((char*) environ,
514+
environ = (char**) safe_realloc((char*) environ,
515515
(MemorySize) (i+2) * sizeof(char*));
516516
/* just expand it a bit */
517517
}
518518
#endif /* lint */
519519
environ[i+1] = nullptr; /* make sure it's null terminated */
520520
}
521-
environ[i] = safemalloc((MemorySize)(namlen + std::strlen(val) + 2));
521+
environ[i] = safe_malloc((MemorySize)(namlen + std::strlen(val) + 2));
522522
/* this may or may not be in */
523523
/* the old environ structure */
524524
std::sprintf(environ[i],"%s=%s",nam,val);/* all that work just for this */

0 commit comments

Comments
 (0)