if (Sprint(sp, "%c", (char)quote) < 0)
if (quote && Sprint(sp, "%c", (char)quote) < 0)
QuoteString(Sprinter *sp, JSString *str, jschar quote){    ptrdiff_t off, len, nb;    const jschar *s, *t, *u, *z;    char *bp;    jschar c;    JSBool ok;    /* Sample off first for later return value pointer computation. */    off = sp->offset;    if (Sprint(sp, "%c", (char)quote) < 0)	return NULL;    /* Loop control variables: z points at end of string sentinel. */    s = JSSTRING_CHARS(str);    z = s + JSSTRING_LENGTH(str);    for (t = s; t < z; s = ++t) {	/* Move t forward from s past un-quote-worthy characters. */	c = *t;	while (JS_ISPRINT(c) && c != quote && c != '\\' && !(c >> 8)) {	    c = *++t;	    if (t == z)		break;	}	len = PTRDIFF(t, s, jschar);	/* Allocate space for s, including the '\0' at the end. */	nb = (sp->offset + len + 1) - sp->size;	if (nb > 0 && !SprintAlloc(sp, nb))	    return NULL;	/* Advance sp->offset and copy s into sp's buffer. */	bp = sp->base + sp->offset;	sp->offset += len;	while (--len >= 0)	    *bp++ = (char) *s++;	*bp = '\0';	if (t == z)	    break;	/* Use js_EscapeMap, \u, or \x only if necessary. */	if ((u = js_strchr(js_EscapeMap, c)) != NULL)	    ok = Sprint(sp, "\\%c", (char)u[1]) >= 0;	else	    ok = Sprint(sp, (c >> 8) ? "\\u%04X" : "\\x%02X", c) >= 0;	if (!ok)	    return NULL;    }    /* Sprint the closing quote and return the quoted string. */    if (Sprint(sp, "%c", (char)quote) < 0)	return NULL;    return OFF2STR(sp, off);}