0999158088e0fb3715eb27703c8c4f7123d77144 galt Mon Sep 21 16:51:20 2015 -0700 added GNU-C attributes to function declarations in src/inc, src/hg/inc, and some CGIs so that the compiler can catch errors where the parameter list given by the user does not match their format string. These var-args functions are like printf. diff --git src/inc/dystring.h src/inc/dystring.h index 892fb7a..10d941b 100644 --- src/inc/dystring.h +++ src/inc/dystring.h @@ -51,32 +51,36 @@ #define dyStringWriteOne(dy, var) dyStringAppendN(dy, (char *)(&var), sizeof(var)) /* Write one variable (binary!) to dyString - for cases when want to treat string like * a file stream. */ void dyStringVaPrintf(struct dyString *ds, char *format, va_list args); /* VarArgs Printf to end of dyString. */ void dyStringPrintf(struct dyString *ds, char *format, ...) /* Printf to end of dyString. */ #ifdef __GNUC__ __attribute__((format(printf, 2, 3))) #endif ; -struct dyString *dyStringCreate(char *format, ...); +struct dyString *dyStringCreate(char *format, ...) /* Create a dyString with a printf style initial content */ +#if defined(__GNUC__) +__attribute__((format(printf, 1, 2))) +#endif +; #define dyStringClear(ds) (ds->string[0] = ds->stringSize = 0) /* Clear string. */ struct dyString * dyStringSub(char *orig, char *in, char *out); /* Make up a duplicate of orig with all occurences of in substituted * with out. */ void dyStringBumpBufSize(struct dyString *ds, int size); /* Force dyString buffer to be at least given size. */ char *dyStringCannibalize(struct dyString **pDy); /* Kill dyString, but return the string it is wrapping * (formerly dy->string). This should be free'd at your * convenience. */