commit - 36cf1d984f751bad1e27981382a674f2ce5da0a4
commit + 16d61a8bc15dd706c6e8ca85bbbbd91d774352ce
blob - 301c305863054d393f81669a78e84314a4e28db4
blob + bf69bf0adcbe8d7ed33329cf08594e5b0b57e5d1
--- FICS/command.c
+++ FICS/command.c
char count[10] = { '\0' };
char junk[MAX_LINE_SIZE] = { '\0' };
char *junkp = NULL;
+ const char *scan_fmt = "%" SCNd64 " " "%9s";
int64_t lval = 0;
time_t crtime = 0;
_Static_assert(ARRAY_SIZE(count) > 9, "Unexpected array size");
- if (sscanf(junk, ("%" SCNd64 " " "%9s"), &lval, count) != 2) {
+ if (sscanf(junk, scan_fmt, &lval, count) != 2) {
warnx("%s: sscanf() error: too few items", __func__);
return;
}
PRIVATE void
check_news(int p, int admin)
{
-#define SCAN_JUNK ("%" SCNd64 " " "%9s")
FILE *fp = NULL;
char count[10] = { '\0' };
char filename[MAX_FILENAME_SIZE] = { '\0' };
char junk[MAX_LINE_SIZE] = { '\0' };
char *junkp = NULL;
+ const char *v_scan_fmt = "%" SCNd64 " " "%9s";
int64_t lval = 0;
time_t crtime = 0;
time_t lc = player_lastconnect(p);
warnx("%s: fgets() error", __func__);
fclose(fp);
return;
- } else if (sscanf(junk, SCAN_JUNK, &lval, count) != 2) {
+ } else if (sscanf(junk, v_scan_fmt, &lval, count) != 2) {
warnx("%s: sscanf() error", __func__);
fclose(fp);
return;
warnx("%s: fgets() error", __func__);
fclose(fp);
return;
- } else if (sscanf(junk, SCAN_JUNK, &lval, count) != 2) {
+ } else if (sscanf(junk, v_scan_fmt, &lval, count) != 2) {
warnx("%s: sscanf() error", __func__);
fclose(fp);
return;