Skip to content

Commit

Permalink
Release dragon_scales_color obuf in doname_base
Browse files Browse the repository at this point in the history
Apply logic from vanilla commit e43ec0c
to an xnh-specific function -- prevent it from needlessly consuming
extra obufs when churning through a lot of inventory (assuming there are
a bunch of dragon-scaled items in there).
  • Loading branch information
entrez authored and copperwater committed Dec 10, 2023
1 parent d563a6e commit 8763860
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/objnam.c
Original file line number Diff line number Diff line change
Expand Up @@ -1296,9 +1296,10 @@ doname_base(
arti_light_description(obj));
}
if (Is_dragon_scaled_armor(obj)) {
char scalebuf[30];
Sprintf(scalebuf, "%s-scaled ", dragon_scales_color(obj));
char scalebuf[30], *colorstr = dragon_scales_color(obj);
Sprintf(scalebuf, "%s-scaled ", colorstr);
Strcat(prefix, scalebuf);
releaseobuf(colorstr); /* don't consume an extra obuf */
}
/*FALLTHRU*/
case WEAPON_CLASS:
Expand Down Expand Up @@ -5544,7 +5545,7 @@ shirt_simple_name(struct obj *shirt UNUSED)
char *
dragon_scales_color(struct obj *obj)
{
char* buf = nextobuf();
char *buf = nextobuf();
if (!obj) {
impossible("dragon_scales_color: null obj");
return NULL;
Expand Down

0 comments on commit 8763860

Please sign in to comment.