diff options
author | drh <> | 2025-02-10 00:20:50 +0000 |
---|---|---|
committer | drh <> | 2025-02-10 00:20:50 +0000 |
commit | 93df8109fc188b35968fa3a4d51400866399fd7c (patch) | |
tree | ff1095a7ec7eea32a9dc9f44956469462cc53ba1 /src/json.c | |
parent | 3efac4aa782fa58857de1018152305e3d7a7c3eb (diff) | |
download | sqlite-93df8109fc188b35968fa3a4d51400866399fd7c.tar.gz sqlite-93df8109fc188b35968fa3a4d51400866399fd7c.zip |
Small performance increase in jsonTranslateBlobToText().
FossilOrigin-Name: 3b1dcac2eeaf5f97450919f2a6eed74a4d54fb2b812bdb4a580f79d075e99dfe
Diffstat (limited to 'src/json.c')
-rw-r--r-- | src/json.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/json.c b/src/json.c index a0a075e66..2517f6c31 100644 --- a/src/json.c +++ b/src/json.c @@ -2199,9 +2199,12 @@ static u32 jsonTranslateBlobToText( } case JSONB_TEXT: case JSONB_TEXTJ: { - jsonAppendChar(pOut, '"'); - jsonAppendRaw(pOut, (const char*)&pParse->aBlob[i+n], sz); - jsonAppendChar(pOut, '"'); + if( pOut->nUsed+sz+2<=pOut->nAlloc || jsonStringGrow(pOut, sz+2)==0 ){ + pOut->zBuf[pOut->nUsed] = '"'; + memcpy(pOut->zBuf+pOut->nUsed+1,(const char*)&pParse->aBlob[i+n],sz); + pOut->zBuf[pOut->nUsed+sz+1] = '"'; + pOut->nUsed += sz+2; + } break; } case JSONB_TEXT5: { |