aboutsummaryrefslogtreecommitdiff
path: root/src/util.c
diff options
context:
space:
mode:
authordrh <>2023-01-03 18:51:18 +0000
committerdrh <>2023-01-03 18:51:18 +0000
commitfbde3f50bfcb2235589a5c248a23b3990fd05d9f (patch)
treefeb6dcd3e2065934d3dc6b1cb238fe469265d66e /src/util.c
parent1eb88d6e5a5bae41ab08df5949d82d816b3bb7d6 (diff)
downloadsqlite-fbde3f50bfcb2235589a5c248a23b3990fd05d9f.tar.gz
sqlite-fbde3f50bfcb2235589a5c248a23b3990fd05d9f.zip
Avoid an unnecessary call to strlen() in the sqlite3VdbeMemStringify() routine,
for a performance increase and size reduction. FossilOrigin-Name: 284382d37850f469dc4bf3ab8efd2f20971554e897f1ba3e94d3f2f0c35d97d0
Diffstat (limited to 'src/util.c')
-rw-r--r--src/util.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/util.c b/src/util.c
index 72faafea5..23c6b1a66 100644
--- a/src/util.c
+++ b/src/util.c
@@ -632,11 +632,14 @@ do_atof_calc:
#endif
/*
-** Render an signed 64-bit integer as text. Store the result in zOut[].
+** Render an signed 64-bit integer as text. Store the result in zOut[] and
+** return the length of the string that was stored, in bytes. The value
+** returned does not include the zero terminator at the end of the output
+** string.
**
** The caller must ensure that zOut[] is at least 21 bytes in size.
*/
-void sqlite3Int64ToText(i64 v, char *zOut){
+int sqlite3Int64ToText(i64 v, char *zOut){
int i;
u64 x;
char zTemp[22];
@@ -653,6 +656,7 @@ void sqlite3Int64ToText(i64 v, char *zOut){
}while( x );
if( v<0 ) zTemp[i--] = '-';
memcpy(zOut, &zTemp[i+1], sizeof(zTemp)-1-i);
+ return sizeof(zTemp)-2-i;
}
/*