]> granicus.if.org Git - libexpat/commitdiff
Review 2017-03-13: replace magic number with appropriate string len
authorRhodri James <rhodri@kynesim.co.uk>
Wed, 15 Mar 2017 12:33:03 +0000 (12:33 +0000)
committerSebastian Pipping <sebastian@pipping.org>
Sat, 22 Jul 2017 19:50:57 +0000 (21:50 +0200)
expat/tests/runtests.c

index 79fbe522b82cc44688714a4cb543b66eb9be8634..10e781cfdb4c0eab7af37be0b1e1a37747ab80fd 100644 (file)
@@ -3673,19 +3673,23 @@ START_TEST(test_byte_info_at_end)
 END_TEST
 
 /* Test position information from errors */
+#define PRE_ERROR_STR  "<doc></"
+#define POST_ERROR_STR "wombat></doc>"
 START_TEST(test_byte_info_at_error)
 {
-    const char *text = "<doc></wombat></doc>";
+    const char *text = PRE_ERROR_STR POST_ERROR_STR;
 
     if (_XML_Parse_SINGLE_BYTES(parser, text, strlen(text),
                                 XML_TRUE) == XML_STATUS_OK)
         fail("Syntax error not faulted");
     if (XML_GetCurrentByteCount(parser) != 0)
         fail("Error byte count incorrect");
-    if (XML_GetCurrentByteIndex(parser) != 7)
+    if (XML_GetCurrentByteIndex(parser) != strlen(PRE_ERROR_STR))
         fail("Error byte index incorrect");
 }
 END_TEST
+#undef PRE_ERROR_STR
+#undef POST_ERROR_STR
 
 /* Test position information in handler */
 static void