summaryrefslogtreecommitdiff
path: root/strings
diff options
context:
space:
mode:
authorunknown <monty@donna.mysql.com>2001-02-20 22:34:47 +0200
committerunknown <monty@donna.mysql.com>2001-02-20 22:34:47 +0200
commit62884b8f36e2bdb7dffd43fe65b7ac17025e6abe (patch)
treef87e7ff2aa4e7016660a9275fe538c9ce99b6dfe /strings
parentdc7eafea57a321c92716b5b84c574a0347ade74f (diff)
downloadmariadb-git-62884b8f36e2bdb7dffd43fe65b7ac17025e6abe.tar.gz
Added max_user_connections
Fixes for Innobase Don't reset whole to-buffer in strxnmov BUILD/compile-pentium-debug: Added innobase include/mysqld_error.h: New error messages innobase/configure.in: Update from heikki innobase/include/lock0types.h: Update from heikki innobase/include/os0sync.h: Update from heikki innobase/include/sync0types.h: Update from heikki innobase/os/os0file.c: Update from heikki innobase/srv/srv0start.c: Update from heikki sql/ha_innobase.cc: Update from Heikki Changed assert -> dbug_assert Changed return -> DBUG_RETURN sql/mysql_priv.h: Added max_user_connections sql/mysqld.cc: Added max_user_connections sql/share/czech/errmsg.txt: Added max_user_connections sql/share/danish/errmsg.txt: Added max_user_connections sql/share/dutch/errmsg.txt: Added max_user_connections sql/share/english/errmsg.txt: Added max_user_connections sql/share/estonian/errmsg.txt: Added max_user_connections sql/share/french/errmsg.txt: Added max_user_connections sql/share/german/errmsg.txt: Added max_user_connections sql/share/greek/errmsg.txt: Added max_user_connections sql/share/hungarian/errmsg.txt: Added max_user_connections sql/share/italian/errmsg.txt: Added max_user_connections sql/share/japanese/errmsg.txt: Added max_user_connections sql/share/korean/errmsg.txt: Added max_user_connections sql/share/norwegian-ny/errmsg.txt: Added max_user_connections sql/share/norwegian/errmsg.txt: Added max_user_connections sql/share/polish/errmsg.txt: Added max_user_connections sql/share/portuguese/errmsg.txt: Added max_user_connections sql/share/romanian/errmsg.txt: Added max_user_connections sql/share/russian/errmsg.txt: Added max_user_connections sql/share/slovak/errmsg.txt: Added max_user_connections sql/share/spanish/errmsg.txt: Added max_user_connections sql/share/swedish/errmsg.OLD: Added max_user_connections sql/share/swedish/errmsg.txt: Added max_user_connections sql/sql_class.h: cleanup strings/str_test.c: Added tests for strxnmov strings/strxnmov.c: Don't reset whole to buffer
Diffstat (limited to 'strings')
-rw-r--r--strings/str_test.c24
-rw-r--r--strings/strxnmov.c24
2 files changed, 30 insertions, 18 deletions
diff --git a/strings/str_test.c b/strings/str_test.c
index 069e7a5b487..bd54bc6d806 100644
--- a/strings/str_test.c
+++ b/strings/str_test.c
@@ -33,13 +33,13 @@
static char from_buff[100],to_buff[100];
static my_string from,to;
static int errors,tests;
-static int test_strarg(char *name,...);
+static int test_strarg(const char *name,...);
static void init_strings (void); /* Init from and to */
-void test_arg (my_string message,long func_value,long value);
-int compare_buff (my_string message,my_string b1,my_string b2,int length,
+void test_arg (const char *message,long func_value,long value);
+int compare_buff(const char *message,my_string b1,my_string b2,int length,
pchar fill, pchar prefill);
-int my_test(int a)
+static int my_test(int a)
{
return a ? 1 : 0;
}
@@ -116,6 +116,14 @@ int main(void)
test_strarg("strxmov(to,from,\"!!\",NullS)",strxmov(to,from,"!!",NullS),to+F_LEN+2,F_LEN,F_CHAR,2,'!',0,0,0);
test_strarg("strxmov(to,NullS)",strxmov(to,NullS),to,1,0,0,0);
test_strarg("strxmov(to,from,from,from,from,from,'!!',from,NullS)",strxmov(to,from,from,from,from,from,"!!",from,NullS),to+F_LEN*6+2,F_LEN,F_CHAR,F_LEN,F_CHAR,F_LEN,F_CHAR,F_LEN,F_CHAR,F_LEN,F_CHAR,2,'!',F_LEN,F_CHAR,1,0,0,0);
+
+ test_strarg("strxnmov(to,100,from,\"!!\",NullS)",strxnmov(to,100,from,"!!",NullS),to+F_LEN+2,F_LEN,F_CHAR,2,'!',0,0,0);
+ test_strarg("strxnmov(to,2,NullS)",strxnmov(to,2,NullS),to,1,0,0,0);
+ test_strarg("strxnmov(to,100,from,from,from,from,from,'!!',from,NullS)",strxnmov(to,100,from,from,from,from,from,"!!",from,NullS),to+F_LEN*6+2,F_LEN,F_CHAR,F_LEN,F_CHAR,F_LEN,F_CHAR,F_LEN,F_CHAR,F_LEN,F_CHAR,2,'!',F_LEN,F_CHAR,1,0,0,0);
+ test_strarg("strxnmov(to,2,\"!!!\",NullS)",strxnmov(to,2,"!!!",NullS),to+2,2,'!',0,0,0);
+ test_strarg("strxnmov(to,2,\"!!\",NullS)",strxnmov(to,2,"!!","xx",NullS),to+2,2,'!',0,0,0);
+ test_strarg("strxnmov(to,2,\"!\",\"x\",\"y\",NullS)",strxnmov(to,2,"!","x","y",NullS),to+2,1,'!',1,'x',0,0,0);
+
test_strarg("bchange(to,2,from,4,6)",(bchange(to,2,from,4,6),0L),INT_MAX32,
4,F_CHAR,2,T_CHAR,0,0);
@@ -156,7 +164,7 @@ void init_strings(void)
/* Test that function return rigth value */
-void test_arg(my_string message, long int func_value, long int value)
+void test_arg(const char *message, long int func_value, long int value)
{
tests++;
printf("testing '%s'\n",message);
@@ -169,7 +177,7 @@ void test_arg(my_string message, long int func_value, long int value)
/* Test function return value and from and to arrays */
-static int test_strarg(char *message,...)
+static int test_strarg(const char *message,...)
{
long func_value,value;
int error,length;
@@ -223,7 +231,7 @@ static int test_strarg(char *message,...)
/* test if function made right value */
-int compare_buff(my_string message, my_string b1, my_string b2, int length,
+int compare_buff(const char *message, my_string b1, my_string b2, int length,
pchar fill, pchar prefill)
{
int i,error=0;
@@ -256,6 +264,8 @@ int compare_buff(my_string message, my_string b1, my_string b2, int length,
/* These are here to be loaded and examined */
+extern void dummy_functions(void);
+
void dummy_functions(void)
{
VOID(memchr(from,'a',5));
diff --git a/strings/strxnmov.c b/strings/strxnmov.c
index 494b227209f..b55a2e0ab79 100644
--- a/strings/strxnmov.c
+++ b/strings/strxnmov.c
@@ -15,9 +15,9 @@
and NOT to use 0, as on some machines 0 is not the same size as a
character pointer, or not the same bit pattern as NullS.
- Note: strxnmov is like strnmov in that it always moves EXACTLY len
- characters; dst will be padded on the right with NUL characters as
- needed. strxncpy does the same. strxncat, like strncat, does NOT.
+ Note: strxnmov is like strnmov in that it moves up to len
+ characters; dst will be padded on the right with one NUL characters if
+ needed.
*/
#include <global.h>
@@ -27,20 +27,22 @@
char *strxnmov(char *dst,uint len, const char *src, ...)
{
va_list pvar;
- char *result;
+ char *end_of_dst=dst+len;
va_start(pvar,src);
- while (src != NullS) {
- do if (len-- == 0)
+ while (src != NullS)
+ {
+ do
{
- va_end(pvar);
- return dst;
+ if (dst == end_of_dst)
+ goto end;
}
- while ((*dst++ = *src++) != 0);
+ while ((*dst++ = *src++));
dst--;
src = va_arg(pvar, char *);
}
- for (result= dst; len-- != 0; *dst++ = 0) ;
+ *dst=0;
+end:
va_end(pvar);
- return result;
+ return dst;
}