Fix sometimes-uninitialized warning in gdbscm_value_address
[deliverable/binutils-gdb.git] / gdb / proc-api.c
index 249aca1329471edca458b9203b1d161e465f03d4..2198b2678e5c2c91846058ff5241442a1a2e8e85 100644 (file)
@@ -1,6 +1,6 @@
 /* Machine independent support for SVR4 /proc (process file system) for GDB.
 
-   Copyright (C) 1999-2013 Free Software Foundation, Inc.
+   Copyright (C) 1999-2017 Free Software Foundation, Inc.
 
    Written by Michael Snyder at Cygnus Solutions.
    Based on work by Fred Fish, Stu Grossman, Geoff Noer, and others.
@@ -34,7 +34,6 @@
 #define _STRUCTURED_PROC 1
 #endif
 
-#include <stdio.h>
 #include <sys/types.h>
 #include <sys/procfs.h>
 #ifdef HAVE_SYS_PROC_H
 
 struct trans {
   long value;                   /* The numeric value */
-  char *name;                   /* The equivalent symbolic value */
-  char *desc;                   /* Short description of value */
+  const char *name;             /* The equivalent symbolic value */
+  const char *desc;             /* Short description of value */
 };
 
 static int   procfs_trace    = 0;
 static FILE *procfs_file     = NULL;
-static char *procfs_filename = "procfs_trace";
+static char *procfs_filename;
 
 static void
 prepare_to_trace (void)
 {
   if (procfs_trace)                    /* if procfs tracing turned on */
     if (procfs_file == NULL)           /* if output file not yet open */
-      if (procfs_filename != NULL)     /* if output filename known */
-       procfs_file = fopen (procfs_filename, "a");     /* open output file */
+      procfs_file = fopen (procfs_filename, "a");      /* open output file */
 }
 
 static void
@@ -735,7 +733,7 @@ wait_with_trace (int *wstat, char *file, int line)
 }
 
 void
-procfs_note (char *msg, char *file, int line)
+procfs_note (const char *msg, const char *file, int line)
 {
   prepare_to_trace ();
   if (procfs_trace)
@@ -770,10 +768,6 @@ proc_prettyfprint_status (long flags, int why, int what, int thread)
     }
 }
 
-
-/* Provide a prototype to silence -Wmissing-prototypes.  */
-extern void _initialize_proc_api (void);
-
 void
 _initialize_proc_api (void)
 {
@@ -786,6 +780,7 @@ Show tracing for /proc api calls."), NULL,
                           NULL, /* FIXME: i18n: */
                           &setlist, &showlist);
 
+  procfs_filename = xstrdup ("procfs_trace");
   add_setshow_filename_cmd ("procfs-file", no_class, &procfs_filename, _("\
 Set filename for /proc tracefile."), _("\
 Show filename for /proc tracefile."), NULL,
This page took 0.025251 seconds and 4 git commands to generate.