From 90cc3102f5fd9f5480039e11b76cb3c2318c4937 Mon Sep 17 00:00:00 2001 From: Pasi Kallinen Date: Tue, 23 Jan 2024 17:56:02 +0200 Subject: [PATCH] Don't use static buffer --- src/invent.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/invent.c b/src/invent.c index 276c8dcda..20a7cf645 100644 --- a/src/invent.c +++ b/src/invent.c @@ -26,7 +26,7 @@ static boolean only_here(struct obj *); static void compactify(char *); static boolean taking_off(const char *); static void mime_action(const char *); -static char *getobj_hands_txt(const char *); +static char *getobj_hands_txt(const char *, char *); static int ckvalidcat(struct obj *); static int ckunpaid(struct obj *); static char *safeq_xprname(struct obj *); @@ -1672,10 +1672,8 @@ any_obj_ok(struct obj *obj) /* return string describing your hands based on action. */ static char * -getobj_hands_txt(const char *action) +getobj_hands_txt(const char *action, char *qbuf) { - static char qbuf[QBUFSZ]; - if (!strcmp(action, "grease")) { Sprintf(qbuf, "your %s", fingers_or_gloves(FALSE)); } else if (!strcmp(action, "write with")) { @@ -1931,7 +1929,7 @@ getobj( Sprintf(menuquery, "What do you want to %s?", word); if (!allowed_choices || *allowed_choices == HANDS_SYM || *buf == HANDS_SYM) - handsbuf = getobj_hands_txt(word); + handsbuf = getobj_hands_txt(word, qbuf); ilet = display_pickinv(allowed_choices, handsbuf, menuquery, allownone, TRUE, allowcnt ? &ctmp : (long *) 0);