Update of /cvsroot/agd/server/src
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15769
Modified Files:
dfuns.c
Log Message:
dfun name as passed to define_id is dup'ed (it's in a local array)
stringdup renamed to xstrdup
Index: dfuns.c
===================================================================
RCS file: /cvsroot/agd/server/src/dfuns.c,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -d -r1.24 -r1.25
--- dfuns.c 21 Jul 2004 12:07:13 -0000 1.24
+++ dfuns.c 23 Jul 2004 17:18:35 -0000 1.25
@@ -42,23 +42,7 @@
for(j=0;j<num_arg;j++) {
args[j] = decl[i].args[j];
}
-#if 0
- for(j=0;j<decl[i].arglen;j++) {
- if(j == 0)
- j = 1;
- /*if(!j)j++;*/ /* Feels like a hack. Any better ways? */
-
- /* FIXME - implement variants in define_name */
- for(k=0;k<decl[i].args[j];k++,j++) {
- if(k == 0) { /* remove this line if variants are implemented */
- numarg++;
- args = xrealloc(args, sizeof(int) * numarg);
- args[numarg-1] = decl[i].args[j+k];
- }
- }
- }
-#endif
- define_id(decl[i].name, ID_DFUN, decl[i].ret, args, num_arg);
+ define_id(xstrdup(decl[i].name), ID_DFUN, decl[i].ret, args, num_arg);
}
}
@@ -95,12 +79,13 @@
void df_input_to(void)
{
if(this_player) {
- this_player->input_to = stringdup(fp->u.s);
+ this_player->input_to = xstrdup(fp->u.s);
this_player->input_to_called = 0;
}
#ifdef DEBUG
else {
- debug("input_to", "input_to() called on non-interactive object\n");
+ if(conf.debuglevel)
+ printf("[input_to] input_to() called on non-interactive object\n");
}
#endif
pop_stack();
@@ -229,7 +214,7 @@
{
char *ret;
if(fp->u.ob && fp->u.ob->name)
- ret = stringdup(fp->u.ob->name);
+ ret = xstrdup(fp->u.ob->name);
else
ret = "<NULL>";
pop_stack();
@@ -333,7 +318,7 @@
void df_capitalize(void)
{
char *s;
- s = stringdup(fp->u.s);
+ s = xstrdup(fp->u.s);
s[0] = toupper(s[0]);
pop_stack();
push_string(s, ST_MALLOC);
|