X-Git-Url: https://jxself.org/git/?a=blobdiff_plain;f=misc.c;h=e42cbc915a7582e78d44ad2f055c8f970437a6b1;hb=97241e87d75a68c2cf2ba56a4cd561d979498c17;hp=b6230ec618454ede5a1d3dfb11fe97faf5697060;hpb=deb61e3dcd060dac685feb71aa21e52165fd8691;p=open-adventure.git diff --git a/misc.c b/misc.c index b6230ec..e42cbc9 100644 --- a/misc.c +++ b/misc.c @@ -21,16 +21,6 @@ void* xmalloc(size_t size) return (ptr); } -char* xstrdup(const char* s) -{ - char* ptr = strdup(s); - if (ptr == NULL) { - fprintf(stderr, "Out of memory!\n"); - exit(EXIT_FAILURE); - } - return (ptr); -} - void packed_to_token(long packed, char token[6]) { // Unpack and map back to ASCII. @@ -111,6 +101,8 @@ void vspeak(const char* msg, va_list ap) size--; } else { long arg = va_arg(ap, long); + if (arg == -1) + arg = 0; i++; // Integer specifier. In order to accommodate the fact that PARMS can have both legitimate integers *and* packed tokens, stringify everything. Future work may eliminate the need for this. if (msg[i] == 'd') {