]> git.ipfire.org Git - thirdparty/FORT-validator.git/commitdiff
Simplify XML reader error handler 137/head
authorLucio Sauer <watermanpaint@posteo.net>
Sun, 2 Jun 2024 23:28:35 +0000 (01:28 +0200)
committerLucio Sauer <watermanpaint@posteo.net>
Sun, 2 Jun 2024 23:53:09 +0000 (01:53 +0200)
No need to check if ptr[strlen(ptr) - 1] is '\n' because because C
strings always end with a null-byte.

src/xml/relax_ng.c

index 4470e7d65ff690ca2f997e6a2c6190f39c8c413c..d386078a7be392bf27c7e183fd75f9ba5639c083 100644 (file)
@@ -38,12 +38,7 @@ relax_ng_log_warn(void *ctx, const char *msg, ...)
 static void
 relax_ng_log_str_err(void *userData, const xmlError *error)
 {
-       char *ptr;
-
-       ptr = error->message;
-       if (ptr[strlen(ptr) - 1] == '\n')
-               ptr[strlen(ptr) - 1] = '\0';
-       pr_val_err("%s (at line %d)", ptr, error->line);
+       pr_val_err("%s (at line %d)", error->message, error->line);
 }
 
 /* Initialize global schema to parse RRDP files */