From: Ben Pfaff Date: Thu, 10 Nov 2011 05:27:41 +0000 (-0800) Subject: GET: Fix confusion over the type of the 'type' parameter. X-Git-Tag: v0.7.9~94 X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=09648bd73c7511f3c70c941b77f559569edae292;p=pspp-builds.git GET: Fix confusion over the type of the 'type' parameter. The 'type' parameter was being used to pass in an "enum reader_command" but it was then later assigned a value of "enum pfm_type". This renames 'type' to 'command' for clarity and just deletes the assignment of the "enum pfm_type" value entirely because the value was not used. Found by Clang. Reported-by: Jeremy Lavergne --- diff --git a/src/language/data-io/get.c b/src/language/data-io/get.c index 028cc3c6..d32f2556 100644 --- a/src/language/data-io/get.c +++ b/src/language/data-io/get.c @@ -66,7 +66,8 @@ cmd_import (struct lexer *lexer, struct dataset *ds) /* Parses a GET or IMPORT command. */ static int -parse_read_command (struct lexer *lexer, struct dataset *ds, enum reader_command type) +parse_read_command (struct lexer *lexer, struct dataset *ds, + enum reader_command command) { struct casereader *reader = NULL; struct file_handle *fh = NULL; @@ -86,15 +87,12 @@ parse_read_command (struct lexer *lexer, struct dataset *ds, enum reader_command if (fh == NULL) goto error; } - else if (type == IMPORT_CMD && lex_match_id (lexer, "TYPE")) + else if (command == IMPORT_CMD && lex_match_id (lexer, "TYPE")) { lex_match (lexer, T_EQUALS); - if (lex_match_id (lexer, "COMM")) - type = PFM_COMM; - else if (lex_match_id (lexer, "TAPE")) - type = PFM_TAPE; - else + if (!lex_match_id (lexer, "COMM") + && !lex_match_id (lexer, "TAPE")) { lex_error_expecting (lexer, "COMM", "TAPE", NULL_SENTINEL); goto error;