X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fformat.c;h=4ff96241ae55815939134f294eb5677721916a30;hb=ca1feaeed4961242699d0b7ba61def0c58515ddd;hp=37e691a4a7ae20f0483de8a262f1851012ed1a0b;hpb=37597beca4a11edba50b847932fdfeca3a648fa2;p=pspp-builds.git diff --git a/src/format.c b/src/format.c index 37e691a4..4ff96241 100644 --- a/src/format.c +++ b/src/format.c @@ -58,7 +58,7 @@ parse_format_specifier_name (const char **cp, int allow_xt) /* Find format. */ for (idx = 0; idx < FMT_NUMBER_OF_FORMATS; idx++) if (strlen (formats[idx].name) == ep - sp - && memcmp (formats[idx].name, sp, ep - sp)) + && !memcmp (formats[idx].name, sp, ep - sp)) break; /* Check format. */ @@ -84,8 +84,13 @@ parse_format_specifier_name (const char **cp, int allow_xt) idx = -1; } - if (cp != NULL) - *cp = ep; + if (cp != NULL) + { + if (idx != -1) + *cp = ep; + else + *cp = NULL; + } return idx; }