Skip to content

Commit

Permalink
Suppress invalid param error for name to fix #270
Browse files Browse the repository at this point in the history
Suppress invalid param error for name to fix #270 for hexnumber, float, number, date-rfc3164 and date-rfc5424.
It will just check if name is "-" to make sure that we only suppress the error message in case we do not want to capture something.
  • Loading branch information
solhuebner committed Mar 21, 2018
1 parent d4136cd commit a3bb256
Showing 1 changed file with 15 additions and 5 deletions.
20 changes: 15 additions & 5 deletions src/parser.c
Original file line number Diff line number Diff line change
Expand Up @@ -467,7 +467,9 @@ PARSER_Construct(RFC5424Date)
fmtmode);
}
} else {
ln_errprintf(ctx, 0, "invalid param for date-rfc5424 %s", key);
if(!(strcmp(key, "name") == 0 && strcmp(json_object_get_string(val), "-") == 0)) {
ln_errprintf(ctx, 0, "invalid param for date-rfc5424 %s", key);
}
}
json_object_iter_next(&it);
}
Expand Down Expand Up @@ -753,7 +755,9 @@ PARSER_Construct(RFC3164Date)
fmtmode);
}
} else {
ln_errprintf(ctx, 0, "invalid param for date-rfc3164 %s", key);
if(!(strcmp(key, "name") == 0 && strcmp(json_object_get_string(val), "-") == 0)) {
ln_errprintf(ctx, 0, "invalid param for date-rfc3164 %s", key);
}
}
json_object_iter_next(&it);
}
Expand Down Expand Up @@ -854,7 +858,9 @@ PARSER_Construct(Number)
fmtmode);
}
} else {
ln_errprintf(ctx, 0, "invalid param for number: %s", key);
if(!(strcmp(key, "name") == 0 && strcmp(json_object_get_string(val), "-") == 0)) {
ln_errprintf(ctx, 0, "invalid param for number: %s", key);
}
}
json_object_iter_next(&it);
}
Expand Down Expand Up @@ -958,7 +964,9 @@ PARSER_Construct(Float)
fmtmode);
}
} else {
ln_errprintf(ctx, 0, "invalid param for float: %s", key);
if(!(strcmp(key, "name") == 0 && strcmp(json_object_get_string(val), "-") == 0)) {
ln_errprintf(ctx, 0, "invalid param for float: %s", key);
}
}
json_object_iter_next(&it);
}
Expand Down Expand Up @@ -1060,7 +1068,9 @@ PARSER_Construct(HexNumber)
fmtmode);
}
} else {
ln_errprintf(ctx, 0, "invalid param for hexnumber: %s", key);
if(!(strcmp(key, "name") == 0 && strcmp(json_object_get_string(val), "-") == 0)) {
ln_errprintf(ctx, 0, "invalid param for hexnumber: %s", key);
}
}
json_object_iter_next(&it);
}
Expand Down

0 comments on commit a3bb256

Please sign in to comment.