Commit 7c9dba22 authored by unknown's avatar unknown
Browse files

InnoDB: Remove ut_str_contains() and replace it with strchr()


innobase/dict/dict0dict.c:
  Replace ut_str_contains() with strchr()
innobase/include/ut0mem.h:
  Remove ut_str_contains(), a reinvented strchr()
innobase/row/row0mysql.c:
  Replace ut_str_contains() with strchr()
innobase/ut/ut0mem.c:
  Remove ut_str_contains(), a reinvented strchr()
parent 19b727ad
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -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 @@ dict_foreign_parse_drop_constraints(

	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);
+0 −8
Original line number Diff line number Diff line
@@ -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"
+1 −1
Original line number Diff line number Diff line
@@ -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
+0 −24
Original line number Diff line number Diff line
@@ -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);
}