[ltrace-commits] 03/03: In parse_typedef_name, delegate identifier-parsing to parse_ident

Petr Machata pmachata-guest at moszumanska.debian.org
Mon Apr 20 07:48:00 UTC 2015


This is an automated email from the git hooks/post-receive script.

pmachata-guest pushed a commit to branch master
in repository ltrace.

commit 44de3577ce20a3700561bd78cca6239b2f333c86
Author: Petr Machata <pmachata at redhat.com>
Date:   Mon Apr 20 09:47:02 2015 +0200

    In parse_typedef_name, delegate identifier-parsing to parse_ident
---
 read_config_file.c | 16 ++++------------
 1 file changed, 4 insertions(+), 12 deletions(-)

diff --git a/read_config_file.c b/read_config_file.c
index fc90ebd..ed2de09 100644
--- a/read_config_file.c
+++ b/read_config_file.c
@@ -345,20 +345,12 @@ fail:
 }
 
 static struct arg_type_info *
-parse_typedef_name(struct protolib *plib, char **str)
+parse_typedef_name(struct protolib *plib, struct locus *loc, char **str)
 {
-	char *end = *str;
-	while (*end && (isalnum(CTYPE_CONV(*end)) || *end == '_'))
-		++end;
-	if (end == *str)
+	char *buf = parse_ident(loc, str);
+	if (buf == NULL)
 		return NULL;
 
-	size_t len = end - *str;
-	char buf[len + 1];
-	memcpy(buf, *str, len);
-	*str += len;
-	buf[len] = 0;
-
 	struct named_type *nt = protolib_lookup_type(plib, buf, true);
 	if (nt == NULL)
 		return NULL;
@@ -850,7 +842,7 @@ parse_nonpointer_type(struct protolib *plib, struct locus *loc,
 			return type;
 
 		*ownp = 0;
-		if ((type = parse_typedef_name(plib, str)) == NULL)
+		if ((type = parse_typedef_name(plib, loc, str)) == NULL)
 			report_error(loc->filename, loc->line_no,
 				     "unknown type around '%s'", orig_str);
 		return type;

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/collab-maint/ltrace.git



More information about the ltrace-commits mailing list