gdb: add target_ops::supports_displaced_step
[deliverable/binutils-gdb.git] / libiberty / spaces.c
index ea925712e3f8cb09b7bb0d67bf77562476af438f..d97390b2ddce15721479afaaaae00ba062d9e101 100644 (file)
@@ -1,5 +1,5 @@
 /* Allocate memory region filled with spaces.
-   Copyright (C) 1991 Free Software Foundation, Inc.
+   Copyright (C) 1991-2020 Free Software Foundation, Inc.
 
 This file is part of the libiberty library.
 Libiberty is free software; you can redistribute it and/or
@@ -14,29 +14,24 @@ Library General Public License for more details.
 
 You should have received a copy of the GNU Library General Public
 License along with libiberty; see the file COPYING.LIB.  If
-not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-Boston, MA 02111-1307, USA.  */
+not, write to the Free Software Foundation, Inc., 51 Franklin Street - Fifth Floor,
+Boston, MA 02110-1301, USA.  */
 
 /*
 
-NAME
+@deftypefn Extension char* spaces (int @var{count})
 
-       spaces -- return a pointer to a buffer full of spaces
+Returns a pointer to a memory region filled with the specified
+number of spaces and null terminated.  The returned pointer is
+valid until at least the next call.
 
-SYNOPSIS
-
-       char *spaces (int count)
-
-DESCRIPTION
-
-       Returns a pointer to a memory region filled with the specified
-       number of spaces and null terminated.  The returned pointer is
-       valid until at least the next call.
-       
-BUGS
+@end deftypefn
 
 */
 
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
 #include "ansidecl.h"
 #include "libiberty.h"
 
@@ -45,13 +40,12 @@ BUGS
 #include <unixlib.h>
 #else
 /* For systems with larger pointers than ints, these must be declared.  */
-extern PTR malloc PARAMS ((size_t));
-extern void free PARAMS ((PTR));
+extern PTR malloc (size_t);
+extern void free (PTR);
 #endif
 
 const char *
-spaces (count)
-  int count;
+spaces (int count)
 {
   register char *t;
   static char *buf;
@@ -59,11 +53,8 @@ spaces (count)
 
   if (count > maxsize)
     {
-      if (buf)
-       {
-         free (buf);
-       }
-      buf = malloc (count + 1);
+      free (buf);
+      buf = (char *) malloc (count + 1);
       if (buf == (char *) 0)
        return 0;
       for (t = buf + count ; t != buf ; )
This page took 0.028204 seconds and 4 git commands to generate.