]> Git Repo - binutils.git/blobdiff - gdb/utils.c
* symtab.c (_initialize_symtab): Remove builtin type
[binutils.git] / gdb / utils.c
index 5fe3b1ebc108d397787e75a7acea4be4788f2870..98adad069d6a717d3ec1a2e6cce833820fbb47c0 100644 (file)
@@ -101,6 +101,10 @@ int asm_demangle = 0;
    international character, and the terminal or window can cope.)  */
 
 int sevenbit_strings = 0;
+
+/* String to be printed before error messages, if any.  */
+
+char *error_pre_print;
 \f
 /* Add a new cleanup to the cleanup_chain,
    and return the previous chain pointer
@@ -134,8 +138,8 @@ do_cleanups (old_chain)
   register struct cleanup *ptr;
   while ((ptr = cleanup_chain) != old_chain)
     {
+      cleanup_chain = ptr->next;       /* Do this first incase recursion */
       (*ptr->function) (ptr->arg);
-      cleanup_chain = ptr->next;
       free (ptr);
     }
 }
@@ -203,6 +207,8 @@ error (va_alist)
   va_start (args);
   target_terminal_ours ();
   fflush (stdout);
+  if (error_pre_print)
+    fprintf (stderr, error_pre_print);
   string = va_arg (args, char *);
   vfprintf (stderr, string, args);
   fprintf (stderr, "\n");
@@ -918,6 +924,7 @@ fputs_demangled (linebuffer, stream, arg_mode)
   /* If user wants to see raw output, no problem.  */
   if (!demangle) {
     fputs_filtered (linebuffer, stream);
+    return;
   }
 
   p = linebuffer;
@@ -1211,8 +1218,9 @@ struct queue *item;
 }
 #endif /* QUEUE_MISSING */
 \f
+#ifndef HAVE_STRSTR
 /* Simple implementation of strstr, since some implementations lack it. */
-char *
+const char *
 strstr (in, find)
      const char *in, *find;
 {
@@ -1220,10 +1228,11 @@ strstr (in, find)
 
   while (0 != (p = strchr (p+1, *find))) {
     if (strcmp (p, find))
-      return (char *)p;
+      return p;
   }
   return 0;
 }
+#endif /* do not HAVE_STRSTR */
 \f
 void
 _initialize_utils ()
This page took 0.025465 seconds and 4 git commands to generate.