# HG changeset patch # User jwe # Date 748245990 0 # Node ID e4acc68c9c601cfc5e12796d618a48faeddbd7b2 # Parent 7573fac6f629af5764a71c0eb8f3b5bff437405e [project @ 1993-09-17 06:06:30 by jwe] (symbol_record::save (ostream&, int)): Don't print a warning for ans being undefined. Call warning to print the message, and change the text to make it clearer. (symbol_table::save (ostream&, int)): Don't crash if there aren't any symbols to save. diff -r 7573fac6f629 -r e4acc68c9c60 src/symtab.cc --- a/src/symtab.cc Thu Sep 16 05:21:34 1993 +0000 +++ b/src/symtab.cc Fri Sep 17 06:06:30 1993 +0000 @@ -412,7 +412,12 @@ else if (fcn != (symbol_def *) NULL) message ("save", "sorry, can't save functions yet"); else - message ("save", "can't save undefined symbols!"); + { +// Kludge! We probably don't want to print warnings for ans, but it +// does seem reasonable to print them for other undefined variables. + if (strcmp (nm, "ans") != 0) + warning ("not saving undefined symbol `%s'", nm); + } return status; } @@ -653,10 +658,16 @@ symbol_table::save (ostream& os, int mark_as_global = 0) { int status = 0; - for (char **names = sorted_var_list (); *names != (char *) NULL; names++) + char **names = sorted_var_list (); + if (names != (char **) NULL) { - if (save (os, *names, mark_as_global)) - status++; + while (*names != (char *) NULL) + { + if (save (os, *names, mark_as_global)) + status++; + + names++; + } } return status; }