AGGREGATE: Simplify code.
authorBen Pfaff <blp@cs.stanford.edu>
Sun, 12 Sep 2010 21:06:55 +0000 (14:06 -0700)
committerBen Pfaff <blp@cs.stanford.edu>
Fri, 24 Sep 2010 03:45:30 +0000 (20:45 -0700)
ds_chomp() returns whether it trimmed off a character, and we might as well
use that instead of doing a redundant check.

src/language/stats/aggregate.c

index bcc8a3be09a9467ebb2bc6cfbd7389f2d67e98ce..15376f62b88142c10fadbcba0720519df66a890c 100644 (file)
@@ -453,14 +453,8 @@ parse_aggregate_functions (struct lexer *lexer, const struct dictionary *dict,
          goto error;
        }
 
-      exclude = MV_ANY;
-
       ds_assign_string (&function_name, lex_tokstr (lexer));
-
-      ds_chomp (&function_name, '.');
-
-      if (lex_tokid(lexer)[strlen (lex_tokid (lexer)) - 1] == '.')
-        exclude = MV_SYSTEM;
+      exclude = ds_chomp (&function_name, '.') ? MV_SYSTEM : MV_ANY;
 
       for (function = agr_func_tab; function->name; function++)
        if (!strcasecmp (function->name, ds_cstr (&function_name)))