From: Ben Pfaff Date: Wed, 8 Apr 2009 04:20:47 +0000 (-0700) Subject: SET LOCALE: Don't use lex_tokstr() after skipping to next token. X-Git-Tag: v0.7.3~172 X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?p=pspp-builds.git;a=commitdiff_plain;h=f1b01009a4d6468f4688a4786752edfcd7899d04 SET LOCALE: Don't use lex_tokstr() after skipping to next token. The return value from lex_tokstr() is only valid until the next call to lex_get() (or another function that changes the current token), so don't advance past the token until we're done with its string value. --- diff --git a/src/language/utilities/set.q b/src/language/utilities/set.q index e8cdf1aa..d264a00e 100644 --- a/src/language/utilities/set.q +++ b/src/language/utilities/set.q @@ -1,5 +1,5 @@ /* PSPP - a program for statistical analysis. - Copyright (C) 1997-9, 2000, 2006 Free Software Foundation, Inc. + Copyright (C) 1997-9, 2000, 2006, 2009 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -376,8 +376,6 @@ stc_custom_locale (struct lexer *lexer, struct dataset *ds UNUSED, s = lex_tokstr (lexer); - lex_get (lexer); - /* First try this string as an encoding name */ if ( valid_encoding (ds_cstr (s))) set_default_encoding (ds_cstr (s)); @@ -393,6 +391,8 @@ stc_custom_locale (struct lexer *lexer, struct dataset *ds UNUSED, return 0; } + lex_get (lexer); + return 1; }