From 7f2a007496e2a9f7e14bd74e99e1d5af3241a5af Mon Sep 17 00:00:00 2001 From: "marko@hundin.mysql.fi" <> Date: Wed, 31 Mar 2004 11:26:56 +0300 Subject: [PATCH] InnoDB: Remove ut_str_contains() and replace it with strchr() --- innobase/dict/dict0dict.c | 6 +++--- innobase/include/ut0mem.h | 8 -------- innobase/row/row0mysql.c | 2 +- innobase/ut/ut0mem.c | 24 ------------------------ 4 files changed, 4 insertions(+), 36 deletions(-) diff --git a/innobase/dict/dict0dict.c b/innobase/dict/dict0dict.c index 40697578cc5..67452c154e7 100644 --- a/innobase/dict/dict0dict.c +++ b/innobase/dict/dict0dict.c @@ -1002,7 +1002,7 @@ dict_table_rename_in_cache( sprintf(foreign->foreign_table_name, "%s", table->name); - if (ut_str_contains(foreign->id, '/')) { + if (strchr(foreign->id, '/')) { ulint db_len; char old_id[2000]; @@ -3331,7 +3331,7 @@ loop: while (foreign != NULL) { if (0 == ut_strcmp(foreign->id, id) - || (ut_str_contains(foreign->id, '/') + || (strchr(foreign->id, '/') && 0 == ut_strcmp(id, dict_remove_db_name(foreign->id)))) { /* Found */ @@ -4059,7 +4059,7 @@ dict_print_info_on_foreign_key_in_create_format( ulint cpy_len; ulint i; - if (ut_str_contains(foreign->id, '/')) { + if (strchr(foreign->id, '/')) { /* Strip the preceding database name from the constraint id */ stripped_id = foreign->id + 1 + dict_get_db_name_len(foreign->id); diff --git a/innobase/include/ut0mem.h b/innobase/include/ut0mem.h index fea6fc243d8..13ee8d5f5fa 100644 --- a/innobase/include/ut0mem.h +++ b/innobase/include/ut0mem.h @@ -85,14 +85,6 @@ ut_str_catenate( /* out, own: catenated null-terminated string */ char* str1, /* in: null-terminated string */ char* str2); /* in: null-terminated string */ -/************************************************************************** -Checks if a null-terminated string contains a certain character. */ - -ibool -ut_str_contains( -/*============*/ - char* str, /* in: null-terminated string */ - char c); /* in: character */ #ifndef UNIV_NONINL #include "ut0mem.ic" diff --git a/innobase/row/row0mysql.c b/innobase/row/row0mysql.c index ab73dc2ad6d..693928dea3e 100644 --- a/innobase/row/row0mysql.c +++ b/innobase/row/row0mysql.c @@ -2362,7 +2362,7 @@ row_rename_table_for_mysql( db_name, constraints_to_drop[i], db_name, constraints_to_drop[i]); - if (!ut_str_contains(constraints_to_drop[i], '/')) { + if (!strchr(constraints_to_drop[i], '/')) { /* If this happens to be an old format constraint, let us delete it. Since all new format constraints contain '/', it does no diff --git a/innobase/ut/ut0mem.c b/innobase/ut/ut0mem.c index eca738f0924..f5d207d8bba 100644 --- a/innobase/ut/ut0mem.c +++ b/innobase/ut/ut0mem.c @@ -221,27 +221,3 @@ 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); -}