/* Change libunistring escapes (\uXXXX and \UXXXXXXXX) to \xXX \uXXXX
and \UXXXXXX. */
-static void
-unistring_escapes_to_guile_escapes (char **bufp, size_t *lenp)
+void
+scm_i_unistring_escapes_to_guile_escapes (char *buf, size_t *lenp)
{
char *before, *after;
size_t i, j;
- before = *bufp;
- after = *bufp;
+ before = buf;
+ after = buf;
i = 0;
j = 0;
while (i < *lenp)
}
}
*lenp = j;
- after = scm_realloc (after, j);
}
/* Change libunistring escapes (\uXXXX and \UXXXXXXXX) to \xXXXX; */
-static void
-unistring_escapes_to_r6rs_escapes (char **bufp, size_t *lenp)
+void
+scm_i_unistring_escapes_to_r6rs_escapes (char *buf, size_t *lenp)
{
char *before, *after;
size_t i, j;
size_t max_out_len = (*lenp * 7) / 6 + 1;
size_t nzeros, ndigits;
- before = *bufp;
+ before = buf;
after = alloca (max_out_len);
i = 0;
j = 0;
}
}
*lenp = j;
- before = scm_realloc (before, j);
memcpy (before, after, j);
}
if (handler == SCM_FAILED_CONVERSION_ESCAPE_SEQUENCE)
{
if (SCM_R6RS_ESCAPES_P)
- unistring_escapes_to_r6rs_escapes (&buf, &len);
+ scm_i_unistring_escapes_to_r6rs_escapes (buf, &len);
else
- unistring_escapes_to_guile_escapes (&buf, &len);
+ scm_i_unistring_escapes_to_guile_escapes (buf, &len);
+
+ buf = scm_realloc (buf, len);
}
if (lenp)
*lenp = len;
SCM_INTERNAL void scm_i_get_substring_spec (size_t len,
SCM start, size_t *cstart,
SCM end, size_t *cend);
+SCM_INTERNAL void scm_i_unistring_escapes_to_guile_escapes (char *buf,
+ size_t *len);
+SCM_INTERNAL void scm_i_unistring_escapes_to_r6rs_escapes (char *buf,
+ size_t *len);
/* Debugging functions */