Make n_spaces return a const char *

n_spaces keeps the spaces in a static buffer.  If a caller overwrites
these, it may give an incorrect result to a subsequent caller.  So,
make the return type const to help avoid this outcome.
This commit is contained in:
Tom Tromey 2021-12-11 15:10:14 -07:00
parent db956d66c9
commit dde238e063
2 changed files with 2 additions and 2 deletions

View file

@ -2303,7 +2303,7 @@ puts_unfiltered (const char *string)
/* Return a pointer to N spaces and a null. The pointer is good /* Return a pointer to N spaces and a null. The pointer is good
until the next call to here. */ until the next call to here. */
char * const char *
n_spaces (int n) n_spaces (int n)
{ {
char *t; char *t;

View file

@ -473,7 +473,7 @@ extern void print_spaces (int, struct ui_file *);
extern void print_spaces_filtered (int, struct ui_file *); extern void print_spaces_filtered (int, struct ui_file *);
extern char *n_spaces (int); extern const char *n_spaces (int);
extern void fputstr_filtered (const char *str, int quotr, extern void fputstr_filtered (const char *str, int quotr,
struct ui_file * stream); struct ui_file * stream);