aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSteven Rostedt <srostedt@redhat.com>2010-03-25 16:18:48 -0400
committerSteven Rostedt <rostedt@goodmis.org>2010-03-25 16:18:48 -0400
commite71d0e2d1ca6a2c308d7097e1232addbe0cad787 (patch)
tree0403249e73b920700469a8f35246780c08e5eea2
parent1cf7aaf41c22fb8fba92e5d77b5c3dee0eae83bf (diff)
parse-events: Fix field_is_string()
The field_is_string() function always returns true because it checks for !strstr(...), which returns 0 if it does not match. Thus the !strstr("char") || !strstr("u8") || !strstr("s8") One would fail and the entire code would end up being true. Also move the field_is_dynamic out of the field_is_string() condition because a field may be dynamic without being a string. Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
-rw-r--r--parse-events.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/parse-events.c b/parse-events.c
index b2941c3..ea7f5dd 100644
--- a/parse-events.c
+++ b/parse-events.c
@@ -1131,8 +1131,8 @@ static int event_read_id(void)
1131static int field_is_string(struct format_field *field) 1131static int field_is_string(struct format_field *field)
1132{ 1132{
1133 if ((field->flags & FIELD_IS_ARRAY) && 1133 if ((field->flags & FIELD_IS_ARRAY) &&
1134 (!strstr(field->type, "char") || !strstr(field->type, "u8") || 1134 (strstr(field->type, "char") || strstr(field->type, "u8") ||
1135 !strstr(field->type, "s8"))) 1135 strstr(field->type, "s8")))
1136 return 1; 1136 return 1;
1137 1137
1138 return 0; 1138 return 0;
@@ -1293,11 +1293,10 @@ static int event_read_fields(struct event_format *event, struct format_field **f
1293 free(brackets); 1293 free(brackets);
1294 } 1294 }
1295 1295
1296 if (field_is_string(field)) { 1296 if (field_is_string(field))
1297 field->flags |= FIELD_IS_STRING; 1297 field->flags |= FIELD_IS_STRING;
1298 if (field_is_dynamic(field)) 1298 if (field_is_dynamic(field))
1299 field->flags |= FIELD_IS_DYNAMIC; 1299 field->flags |= FIELD_IS_DYNAMIC;
1300 }
1301 1300
1302 if (test_type_token(type, token, EVENT_OP, ";")) 1301 if (test_type_token(type, token, EVENT_OP, ";"))
1303 goto fail; 1302 goto fail;