summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBruno Haible <bruno@clisp.org>2002-01-30 13:50:38 +0000
committerBruno Haible <bruno@clisp.org>2009-06-22 01:10:51 +0200
commitc6552f4c06ad9400205f4c5391874fac72938881 (patch)
tree5c0ee788a76188c4376678fb6ddd1e4a1a43c36c
parentc7b5313acb1c1ec7f76201eaadc765b1997809be (diff)
downloadexternal_gettext-c6552f4c06ad9400205f4c5391874fac72938881.zip
external_gettext-c6552f4c06ad9400205f4c5391874fac72938881.tar.gz
external_gettext-c6552f4c06ad9400205f4c5391874fac72938881.tar.bz2
Small cleanup for memory management.
-rw-r--r--src/ChangeLog7
-rw-r--r--src/x-ycp.c15
2 files changed, 15 insertions, 7 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index b224dae..40b6d64 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,5 +1,12 @@
2002-01-27 Bruno Haible <bruno@clisp.org>
+ * x-ycp.c (enum token_type_ty): New enum value token_type_symbol.
+ (x_ycp_lex): Assign a value to tp->string if and only if the type is
+ token_type_string_literal or token_type_symbol.
+ (extract_ycp): Simplify cleanup.
+
+2002-01-27 Bruno Haible <bruno@clisp.org>
+
* x-java.l (extract_java): Don't create a plural message if the
function can take two string argument but actually has only one
string argument.
diff --git a/src/x-ycp.c b/src/x-ycp.c
index 7fb0088..fbc4f0d 100644
--- a/src/x-ycp.c
+++ b/src/x-ycp.c
@@ -1,5 +1,5 @@
/* xgettext YCP backend.
- Copyright (C) 2001 Free Software Foundation, Inc.
+ Copyright (C) 2001-2002 Free Software Foundation, Inc.
This file was written by Bruno Haible <haible@clisp.cons.org>, 2001.
@@ -50,7 +50,8 @@ enum token_type_ty
token_type_comma, /* , */
token_type_i18n, /* _( */
token_type_string_literal, /* "abc" */
- token_type_other /* number, symbol, misc. operator */
+ token_type_symbol, /* symbol, number */
+ token_type_other /* misc. operator */
};
typedef enum token_type_ty token_type_ty;
@@ -58,7 +59,7 @@ typedef struct token_ty token_ty;
struct token_ty
{
token_type_ty type;
- char *string;
+ char *string; /* for token_type_string_literal, token_type_symbol */
int line_number;
};
@@ -389,7 +390,6 @@ x_ycp_lex (tp)
int bufpos;
int c;
- tp->string = NULL;
for (;;)
{
tp->line_number = line_number;
@@ -474,7 +474,7 @@ x_ycp_lex (tp)
}
buffer[bufpos] = '\0';
tp->string = xstrdup (buffer);
- tp->type = token_type_other;
+ tp->type = token_type_symbol;
return;
case '"':
@@ -606,9 +606,10 @@ extract_ycp (f, real_filename, logical_filename, mdlp)
case token_type_eof:
break;
+ case token_type_symbol:
+ free (token.string);
+ /* FALLTHROUGH */
default:
- if (token.string != NULL)
- free (token.string);
state = 0;
continue;
}