replace core use of strdup() with dupstr() (trunk only)

This commit is contained in:
nethack.rankin
2012-03-10 02:22:07 +00:00
parent a4cb32e786
commit 78127038a0
3 changed files with 9 additions and 9 deletions

View File

@@ -1020,7 +1020,7 @@ const char* filename;
if (validate(fd, filename)==0) { if (validate(fd, filename)==0) {
char tplname[PL_NSIZ]; char tplname[PL_NSIZ];
get_plname_from_file(fd, tplname); get_plname_from_file(fd, tplname);
result = strdup(tplname); result = dupstr(tplname);
} }
(void) close(fd); (void) close(fd);
} }
@@ -1047,7 +1047,7 @@ const char* filename;
for (k=0; name[k]; k++) for (k=0; name[k]; k++)
if ( name[k]=='_' ) if ( name[k]=='_' )
name[k]=' '; name[k]=' ';
return strdup(name); return dupstr(name);
} else } else
# endif /* UNIX && QT_GRAPHICS */ # endif /* UNIX && QT_GRAPHICS */
{ {
@@ -2363,7 +2363,7 @@ int src;
#endif #endif
#ifdef USER_SOUNDS #ifdef USER_SOUNDS
} else if (match_varname(buf, "SOUNDDIR", 8)) { } else if (match_varname(buf, "SOUNDDIR", 8)) {
sounddir = (char *)strdup(bufp); sounddir = (char *)dupstr(bufp);
} else if (match_varname(buf, "SOUND", 5)) { } else if (match_varname(buf, "SOUND", 5)) {
add_sound_mapping(bufp); add_sound_mapping(bufp);
#endif #endif
@@ -2372,15 +2372,15 @@ int src;
} else if (match_varname(buf, "QT_TILEWIDTH", 12)) { } else if (match_varname(buf, "QT_TILEWIDTH", 12)) {
extern char *qt_tilewidth; extern char *qt_tilewidth;
if (qt_tilewidth == NULL) if (qt_tilewidth == NULL)
qt_tilewidth=(char *)strdup(bufp); qt_tilewidth=(char *)dupstr(bufp);
} else if (match_varname(buf, "QT_TILEHEIGHT", 13)) { } else if (match_varname(buf, "QT_TILEHEIGHT", 13)) {
extern char *qt_tileheight; extern char *qt_tileheight;
if (qt_tileheight == NULL) if (qt_tileheight == NULL)
qt_tileheight=(char *)strdup(bufp); qt_tileheight=(char *)dupstr(bufp);
} else if (match_varname(buf, "QT_FONTSIZE", 11)) { } else if (match_varname(buf, "QT_FONTSIZE", 11)) {
extern char *qt_fontsize; extern char *qt_fontsize;
if (qt_fontsize == NULL) if (qt_fontsize == NULL)
qt_fontsize=(char *)strdup(bufp); qt_fontsize=(char *)dupstr(bufp);
} else if (match_varname(buf, "QT_COMPACT", 10)) { } else if (match_varname(buf, "QT_COMPACT", 10)) {
extern int qt_compact_mode; extern int qt_compact_mode;
qt_compact_mode = atoi(bufp); qt_compact_mode = atoi(bufp);

View File

@@ -1101,7 +1101,7 @@ const char *mapping;
new_map->pattern = (char *)alloc(strlen(text) + 1); new_map->pattern = (char *)alloc(strlen(text) + 1);
Strcpy(new_map->pattern, text); Strcpy(new_map->pattern, text);
#endif #endif
new_map->filename = strdup(filespec); new_map->filename = dupstr(filespec);
new_map->volume = volume; new_map->volume = volume;
new_map->next = soundmap; new_map->next = soundmap;

View File

@@ -41,8 +41,8 @@ sys_early_init(){
#ifdef PANICTRACE #ifdef PANICTRACE
/* panic options */ /* panic options */
sysopt.gdbpath = strdup(GDBPATH); sysopt.gdbpath = dupstr(GDBPATH);
sysopt.greppath = strdup(GREPPATH); sysopt.greppath = dupstr(GREPPATH);
# ifdef BETA # ifdef BETA
sysopt.panictrace_gdb = 1; sysopt.panictrace_gdb = 1;
# ifdef PANICTRACE_LIBC # ifdef PANICTRACE_LIBC