]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blobdiff - gdb/xml-support.c
-Wwrite-strings: The Rest
[thirdparty/binutils-gdb.git] / gdb / xml-support.c
index cb97beea70389880b5639808db524c4a5ffba23a..ea0657d9b8573114846461e10e8fb0ebb9e35c41 100644 (file)
@@ -355,27 +355,29 @@ gdb_xml_end_element (void *data, const XML_Char *name)
   /* Call the element processor.  */
   if (scope->element != NULL && scope->element->end_handler)
     {
-      char *body;
+      const char *scope_body;
 
       if (scope->body == NULL)
-       body = "";
+       scope_body = "";
       else
        {
          int length;
 
          length = obstack_object_size (scope->body);
          obstack_1grow (scope->body, '\0');
-         body = (char *) obstack_finish (scope->body);
+         char *body = (char *) obstack_finish (scope->body);
 
          /* Strip leading and trailing whitespace.  */
          while (length > 0 && ISSPACE (body[length-1]))
            body[--length] = '\0';
          while (*body && ISSPACE (*body))
            body++;
+
+         scope_body = body;
        }
 
       scope->element->end_handler (parser, scope->element, parser->user_data,
-                                  body);
+                                  scope_body);
     }
   else if (scope->element == NULL)
     XML_DefaultCurrent (parser->expat_parser);