mirror of
https://github.com/ncruces/go-sqlite3.git
synced 2026-01-12 05:59:14 +00:00
Tweaks.
This commit is contained in:
@@ -1,10 +1,10 @@
|
||||
#include_next <math.h> // the system math.h
|
||||
|
||||
#ifndef _WASM_SIMD128_MATH_H
|
||||
#define _WASM_SIMD128_MATH_H
|
||||
|
||||
#include <wasm_simd128.h>
|
||||
|
||||
#include_next <math.h> // the system math.h
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
#include_next <stdlib.h> // the system stdlib.h
|
||||
|
||||
#ifndef _WASM_SIMD128_STDLIB_H
|
||||
#define _WASM_SIMD128_STDLIB_H
|
||||
|
||||
#include_next <stdlib.h> // the system stdlib.h
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
#include_next <string.h> // the system string.h
|
||||
|
||||
#ifndef _WASM_SIMD128_STRING_H
|
||||
#define _WASM_SIMD128_STRING_H
|
||||
|
||||
@@ -5,8 +7,6 @@
|
||||
#include <wasm_simd128.h>
|
||||
#include <__macro_PAGESIZE.h>
|
||||
|
||||
#include_next <string.h> // the system string.h
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
@@ -657,6 +657,7 @@ char *strstr(const char *haystk, const char *needle) {
|
||||
// Simple wrappers already in musl:
|
||||
// - mempcpy
|
||||
// - strcat
|
||||
// - strlcat
|
||||
// - strdup
|
||||
// - strndup
|
||||
// - strnlen
|
||||
@@ -666,7 +667,6 @@ char *strstr(const char *haystk, const char *needle) {
|
||||
|
||||
__attribute__((weak))
|
||||
void *memccpy(void *__restrict dest, const void *__restrict src, int c, size_t n) {
|
||||
void *memchr(const void *v, int c, size_t n);
|
||||
const void *m = memchr(src, c, n);
|
||||
if (m != NULL) {
|
||||
n = (char *)m - (char *)src + 1;
|
||||
@@ -676,6 +676,17 @@ void *memccpy(void *__restrict dest, const void *__restrict src, int c, size_t n
|
||||
return (void *)m;
|
||||
}
|
||||
|
||||
__attribute__((weak))
|
||||
size_t strlcpy(char *__restrict dest, const char *__restrict src, size_t n) {
|
||||
size_t slen = strlen(src);
|
||||
if (n--) {
|
||||
if (n > slen) n = slen;
|
||||
memcpy(dest, src, n);
|
||||
dest[n] = 0;
|
||||
}
|
||||
return slen;
|
||||
}
|
||||
|
||||
__attribute__((weak))
|
||||
char *strncat(char *__restrict dest, const char *__restrict src, size_t n) {
|
||||
size_t strnlen(const char *s, size_t n);
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
#include_next <strings.h> // the system strings.h
|
||||
|
||||
#ifndef _WASM_SIMD128_STRINGS_H
|
||||
#define _WASM_SIMD128_STRINGS_H
|
||||
|
||||
@@ -7,8 +9,6 @@
|
||||
#include <wasm_simd128.h>
|
||||
#include <__macro_PAGESIZE.h>
|
||||
|
||||
#include_next <strings.h> // the system strings.h
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
@@ -20,7 +20,7 @@ int bcmp(const void *v1, const void *v2, size_t n) {
|
||||
return __memcmpeq(v1, v2, n);
|
||||
}
|
||||
|
||||
v128_t __tolower8x16(v128_t v) {
|
||||
static v128_t __tolower8x16(v128_t v) {
|
||||
__i8x16 i;
|
||||
i = v + wasm_i8x16_splat(INT8_MAX - ('Z'));
|
||||
i = i > wasm_i8x16_splat(INT8_MAX - ('Z' - 'A' + 1));
|
||||
|
||||
41
sqlite3/strcasecmp.patch
Normal file
41
sqlite3/strcasecmp.patch
Normal file
@@ -0,0 +1,41 @@
|
||||
# Use strcasecmp and strncasecmp.
|
||||
--- sqlite3.c.orig
|
||||
+++ sqlite3.c
|
||||
@@ -35685,35 +35685,15 @@
|
||||
return sqlite3StrICmp(zLeft, zRight);
|
||||
}
|
||||
SQLITE_PRIVATE int sqlite3StrICmp(const char *zLeft, const char *zRight){
|
||||
- unsigned char *a, *b;
|
||||
- int c, x;
|
||||
- a = (unsigned char *)zLeft;
|
||||
- b = (unsigned char *)zRight;
|
||||
- for(;;){
|
||||
- c = *a;
|
||||
- x = *b;
|
||||
- if( c==x ){
|
||||
- if( c==0 ) break;
|
||||
- }else{
|
||||
- c = (int)UpperToLower[c] - (int)UpperToLower[x];
|
||||
- if( c ) break;
|
||||
- }
|
||||
- a++;
|
||||
- b++;
|
||||
- }
|
||||
- return c;
|
||||
+ return strcasecmp(zLeft, zRight);
|
||||
}
|
||||
SQLITE_API int sqlite3_strnicmp(const char *zLeft, const char *zRight, int N){
|
||||
- register unsigned char *a, *b;
|
||||
if( zLeft==0 ){
|
||||
return zRight ? -1 : 0;
|
||||
}else if( zRight==0 ){
|
||||
return 1;
|
||||
}
|
||||
- a = (unsigned char *)zLeft;
|
||||
- b = (unsigned char *)zRight;
|
||||
- while( N-- > 0 && *a!=0 && UpperToLower[*a]==UpperToLower[*b]){ a++; b++; }
|
||||
- return N<0 ? 0 : UpperToLower[*a] - UpperToLower[*b];
|
||||
+ return strncasecmp(zLeft, zRight, N);
|
||||
}
|
||||
|
||||
/*
|
||||
Reference in New Issue
Block a user