Fix scm_to_utf8_stringn to return the length in bytes, et al
authorMark H Weaver <mhw@netris.org>
Mon, 2 Apr 2012 22:55:45 +0000 (18:55 -0400)
committerMark H Weaver <mhw@netris.org>
Mon, 2 Apr 2012 22:55:45 +0000 (18:55 -0400)
commite26da7a24e79cf3a9d3052e78228a9dfed3c4f3d
tree71aa17975e2e1e647d9151b3ec228daada4f3daf
parent2c1b79513b7b5826db48b6e5e1d7f4dc7731d13b
Fix scm_to_utf8_stringn to return the length in bytes, et al

* libguile/strings.c (u32_u8_length_in_bytes): Internal static function
  renamed from u32_u8_strlen, whose name was potentially confusing.  For
  added safety, handle everything that can be encoded in the more
  general UTF-8 encoding: up to six bytes for each code point, with code
  points up to 2^31-1.

  (scm_to_utf8_stringn): NUL-terminate only if (lenp == NULL).
  If (lenp != NULL) return the length in bytes in *lenp.
libguile/strings.c