diff options
Diffstat (limited to 'contrib/ncurses/ncurses/tinfo/name_match.c')
-rw-r--r-- | contrib/ncurses/ncurses/tinfo/name_match.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/contrib/ncurses/ncurses/tinfo/name_match.c b/contrib/ncurses/ncurses/tinfo/name_match.c index 934b24a..e7205d5 100644 --- a/contrib/ncurses/ncurses/tinfo/name_match.c +++ b/contrib/ncurses/ncurses/tinfo/name_match.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1999,2000 Free Software Foundation, Inc. * + * Copyright (c) 1999,2000,2001 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -34,7 +34,7 @@ #include <term.h> #include <tic.h> -MODULE_ID("$Id: name_match.c,v 1.10 2000/12/10 02:55:08 tom Exp $") +MODULE_ID("$Id: name_match.c,v 1.11 2001/09/22 21:11:34 tom Exp $") /* * _nc_first_name(char *names) @@ -46,10 +46,12 @@ NCURSES_EXPORT(char *) _nc_first_name(const char *const sp) /* get the first name from the given name list */ { - static char buf[MAX_NAME_SIZE + 1]; + static char *buf; register unsigned n; - for (n = 0; n < sizeof(buf) - 1; n++) { + if (buf == 0) + buf = _nc_doalloc(buf, MAX_NAME_SIZE + 1); + for (n = 0; n < MAX_NAME_SIZE; n++) { if ((buf[n] = sp[n]) == '\0' || (buf[n] == '|')) break; |