mirror of
https://github.com/MariaDB/server.git
synced 2025-01-18 21:12:26 +01:00
1065f2bbd6
innobase/dict/dict0boot.c: Auto merged innobase/dict/dict0load.c: Auto merged innobase/dict/dict0mem.c: Auto merged innobase/fut/fut0lst.c: Auto merged innobase/include/buf0lru.h: Auto merged innobase/include/dict0mem.h: Auto merged innobase/include/fsp0fsp.h: Auto merged innobase/include/ha0ha.h: Auto merged innobase/include/ibuf0ibuf.h: Auto merged innobase/include/lock0lock.h: Auto merged innobase/include/log0log.h: Auto merged innobase/include/mem0pool.h: Auto merged innobase/include/mtr0mtr.h: Auto merged innobase/include/os0file.h: Auto merged innobase/include/rem0rec.h: Auto merged innobase/include/rem0rec.ic: Auto merged innobase/include/srv0srv.h: Auto merged innobase/include/sync0sync.h: Auto merged innobase/include/trx0sys.h: Auto merged innobase/include/ut0byte.h: Auto merged innobase/include/ut0ut.h: Auto merged innobase/mem/mem0pool.c: Auto merged innobase/mtr/mtr0mtr.c: Auto merged innobase/os/os0proc.c: Auto merged innobase/pars/lexyy.c: Auto merged innobase/pars/pars0opt.c: Auto merged innobase/row/row0ins.c: Auto merged innobase/row/row0purge.c: Auto merged innobase/row/row0uins.c: Auto merged innobase/row/row0umod.c: Auto merged innobase/row/row0undo.c: Auto merged innobase/row/row0upd.c: Auto merged innobase/trx/trx0purge.c: Auto merged innobase/trx/trx0roll.c: Auto merged innobase/trx/trx0sys.c: Auto merged innobase/trx/trx0undo.c: Auto merged innobase/ut/ut0byte.c: Auto merged pstack/bucomm.h: Auto merged pstack/budbg.h: Auto merged sql/item_sum.h: Auto merged sql/slave.cc: Auto merged sql/sql_db.cc: Auto merged support-files/mysql.spec.sh: Auto merged tests/insert_test.c: Auto merged mysql-test/t/func_group.test: Merge with 4.0 Put 4.1 tests lasts sql/ha_innodb.cc: Merge with 4.0 Added checking of results from my_malloc() BitKeeper/etc/logging_ok: Logging to logging@openlogging.org accepted
79 lines
1.7 KiB
C
79 lines
1.7 KiB
C
/*******************************************************************
|
|
Byte utilities
|
|
|
|
(c) 1994, 1995 Innobase Oy
|
|
|
|
Created 5/11/1994 Heikki Tuuri
|
|
********************************************************************/
|
|
|
|
#include "ut0byte.h"
|
|
|
|
#ifdef UNIV_NONINL
|
|
#include "ut0byte.ic"
|
|
#endif
|
|
|
|
#include "ut0sort.h"
|
|
|
|
/* Zero value for a dulint */
|
|
dulint ut_dulint_zero = {0, 0};
|
|
|
|
/* Maximum value for a dulint */
|
|
dulint ut_dulint_max = {0xFFFFFFFFUL, 0xFFFFFFFFUL};
|
|
|
|
/****************************************************************
|
|
Sort function for dulint arrays. */
|
|
void
|
|
ut_dulint_sort(dulint* arr, dulint* aux_arr, ulint low, ulint high)
|
|
/*===============================================================*/
|
|
{
|
|
UT_SORT_FUNCTION_BODY(ut_dulint_sort, arr, aux_arr, low, high,
|
|
ut_dulint_cmp);
|
|
}
|
|
|
|
/****************************************************************
|
|
Copies a string to a memory location, setting characters to lower case. */
|
|
|
|
void
|
|
ut_cpy_in_lower_case(
|
|
/*=================*/
|
|
char* dest, /* in: destination */
|
|
const char* source, /* in: source */
|
|
ulint len) /* in: string length */
|
|
{
|
|
ulint i;
|
|
|
|
for (i = 0; i < len; i++) {
|
|
dest[i] = tolower(source[i]);
|
|
}
|
|
}
|
|
|
|
/****************************************************************
|
|
Compares two strings when converted to lower case. */
|
|
|
|
int
|
|
ut_cmp_in_lower_case(
|
|
/*=================*/
|
|
/* out: -1, 0, 1 if str1 < str2, str1 == str2,
|
|
str1 > str2, respectively */
|
|
const char* str1, /* in: string1 */
|
|
const char* str2) /* in: string2 */
|
|
{
|
|
for (;;) {
|
|
int c1, c2;
|
|
if (!*str1) {
|
|
return(*str2 ? -1 : 0);
|
|
} else if (!*str2) {
|
|
return 1;
|
|
}
|
|
c1 = tolower(*str1++);
|
|
c2 = tolower(*str2++);
|
|
if (c1 < c2) {
|
|
return(-1);
|
|
}
|
|
if (c1 > c2) {
|
|
return(1);
|
|
}
|
|
}
|
|
|
|
return(0);
|
|
}
|