[1179] in Coldmud discussion meeting

root meeting help first previous next last

[COLD] YAP to string_prep

daemon@ATHENA.MIT.EDU (Sun Dec 15 20:08:32 1996 )

Date: Sun, 15 Dec 1996 16:59:18 -0800 (PST)
From: Brian Buchanan <brian@wasteland.calbbs.com>
To: coldstuff@cold.org


Courtesy of Miro, here is another patch to string_prep which fixes the 
dict hashing problem noticed with .capitalize() and friends.

*** string.c.old	Sun Dec 15 16:20:50 1996
--- string.c	Sun Dec 15 16:38:04 1996
***************
*** 289,294 ****
--- 289,295 ----
          /* Move the string's contents into a new string. */
          cnew = string_new(len);
          MEMCPY(cnew->s, str->s + start, (len > str->len) ? str->len : len);
+ 	cnew->s[len]=0;
          cnew->len = len;
          string_discard(str);
          return cnew;
***************
*** 303,308 ****
--- 304,310 ----
          size = len + 1;
  #endif
          str = (cStr *)erealloc(str, sizeof(cStr)+(size * sizeof(char)));
+ 	str->s[start+len]=0;
          str->size = size;
          return str;
      } else {


-------------

Brian