diff options
author | unknown <monty@mysql.com> | 2004-05-11 12:21:38 +0300 |
---|---|---|
committer | unknown <monty@mysql.com> | 2004-05-11 12:21:38 +0300 |
commit | 19f41e6e0df2d875cff2404f9bbbab30d81b72b1 (patch) | |
tree | 0752eb9dfe0f1e306cf9a542e09d9cc646c11a0f /innobase/ut/ut0mem.c | |
parent | cb24e8b9b29f1aa3edfc4d7a61a9d842cb48ca69 (diff) | |
parent | f3d691a970627f34ed825a9cf7b84520dcdd43b3 (diff) | |
download | mariadb-git-19f41e6e0df2d875cff2404f9bbbab30d81b72b1.tar.gz |
Merge bk-internal.mysql.com:/home/bk/mysql-5.0
into mysql.com:/home/my/mysql-5.0
sql/mysql_priv.h:
Auto merged
sql/opt_range.cc:
Auto merged
sql/sp.cc:
Auto merged
sql/sql_acl.cc:
Auto merged
sql/sql_lex.cc:
Auto merged
sql-bench/limits/mysql-4.0.cfg:
Auto merged
Diffstat (limited to 'innobase/ut/ut0mem.c')
-rw-r--r-- | innobase/ut/ut0mem.c | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/innobase/ut/ut0mem.c b/innobase/ut/ut0mem.c index c367ea10ee1..f7c0e1be9bd 100644 --- a/innobase/ut/ut0mem.c +++ b/innobase/ut/ut0mem.c @@ -258,3 +258,51 @@ ut_str_catenate( return(str); } + +/************************************************************************** +Checks if a null-terminated string contains a certain character. */ + +ibool +ut_str_contains( +/*============*/ + char* str, /* in: null-terminated string */ + char c) /* in: character */ +{ + ulint len; + ulint i; + + len = ut_strlen(str); + + for (i = 0; i < len; i++) { + if (str[i] == c) { + + return(TRUE); + } + } + + return(FALSE); +} + +/************************************************************************** +Return a copy of the given string. The returned string must be freed +using mem_free. */ + +char* +ut_strdup( +/*======*/ + /* out, own: cnull-terminated string */ + char* str) /* in: null-terminated string */ +{ + ulint len; + char* copy; + + len = ut_strlen(str); + + copy = mem_alloc(len + 1); + + ut_memcpy(copy, str, len); + + copy[len] = 0; + + return(copy); +} |