diff options
author | Ben Longbons <b.r.longbons@gmail.com> | 2011-09-10 16:12:07 -0700 |
---|---|---|
committer | Ben Longbons <b.r.longbons@gmail.com> | 2011-09-10 16:12:07 -0700 |
commit | f841b6fdcc802e73d52da0e67ee192c0c2c1c7e1 (patch) | |
tree | d9b013ab252968ec1e90e721f7b2ab819af0acb0 /src/char_sql/strlib.c | |
parent | 5939e1bec75f2550d3ce109b9cd9a5d22c0626c2 (diff) | |
parent | 723fb5d3431b847526c433a13aa74485cfb564a3 (diff) | |
download | tmwa-f841b6fdcc802e73d52da0e67ee192c0c2c1c7e1.tar.gz tmwa-f841b6fdcc802e73d52da0e67ee192c0c2c1c7e1.tar.bz2 tmwa-f841b6fdcc802e73d52da0e67ee192c0c2c1c7e1.tar.xz tmwa-f841b6fdcc802e73d52da0e67ee192c0c2c1c7e1.zip |
Merge commit '723fb5d3431b847526c433a13aa74485cfb564a3'
Diffstat (limited to 'src/char_sql/strlib.c')
-rw-r--r-- | src/char_sql/strlib.c | 89 |
1 files changed, 0 insertions, 89 deletions
diff --git a/src/char_sql/strlib.c b/src/char_sql/strlib.c deleted file mode 100644 index 02911d1..0000000 --- a/src/char_sql/strlib.c +++ /dev/null @@ -1,89 +0,0 @@ -#include <stdio.h> -#include <stdlib.h> -#include <string.h> - -#include "strlib.h" -#include "utils.h" - -//----------------------------------------------- -// string lib. -unsigned char *jstrescape (unsigned char *pt) -{ - //copy from here - unsigned char *ptr; - int i = 0, j = 0; - - //copy string to temporary - CREATE (ptr, char, J_MAX_MALLOC_SIZE); - strcpy (ptr, pt); - - while (ptr[i] != '\0') - { - switch (ptr[i]) - { - case '\'': - pt[j++] = '\\'; - pt[j++] = ptr[i++]; - break; - case '\\': - pt[j++] = '\\'; - pt[j++] = ptr[i++]; - break; - default: - pt[j++] = ptr[i++]; - } - } - pt[j++] = '\0'; - free (ptr); - return (unsigned char *) &pt[0]; -} - -unsigned char *jstrescapecpy (unsigned char *pt, unsigned char *spt) -{ - //copy from here - int i = 0, j = 0; - - while (spt[i] != '\0') - { - switch (spt[i]) - { - case '\'': - pt[j++] = '\\'; - pt[j++] = spt[i++]; - break; - case '\\': - pt[j++] = '\\'; - pt[j++] = spt[i++]; - break; - default: - pt[j++] = spt[i++]; - } - } - pt[j++] = '\0'; - return (unsigned char *) &pt[0]; -} - -int jmemescapecpy (unsigned char *pt, unsigned char *spt, int size) -{ - //copy from here - int i = 0, j = 0; - - while (i < size) - { - switch (spt[i]) - { - case '\'': - pt[j++] = '\\'; - pt[j++] = spt[i++]; - break; - case '\\': - pt[j++] = '\\'; - pt[j++] = spt[i++]; - break; - default: - pt[j++] = spt[i++]; - } - } - // copy size is 0 ~ (j-1) - return j; -} |