2008-01-27 15:00:04 +01:00
|
|
|
/***************************************************************************
|
|
|
|
|
|
|
|
gb_common_string.h
|
|
|
|
|
2022-09-12 15:13:13 +02:00
|
|
|
(c) 2000-2017 Benoît Minisini <benoit.minisini@gambas-basic.org>
|
2008-01-27 15:00:04 +01:00
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
2009-08-17 12:41:51 +02:00
|
|
|
the Free Software Foundation; either version 2, or (at your option)
|
2008-01-27 15:00:04 +01:00
|
|
|
any later version.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with this program; if not, write to the Free Software
|
2011-06-03 02:51:09 +02:00
|
|
|
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
2011-12-31 03:39:20 +01:00
|
|
|
MA 02110-1301, USA.
|
2008-01-27 15:00:04 +01:00
|
|
|
|
|
|
|
***************************************************************************/
|
|
|
|
|
|
|
|
#ifndef __GB_COMMON_STRING_H
|
|
|
|
#define __GB_COMMON_STRING_H
|
|
|
|
|
|
|
|
bool STRING_equal_same(const char *str1, const char *str2, int len);
|
2011-09-08 22:23:15 +02:00
|
|
|
bool STRING_equal_ignore_case_same(const char *str1, const char *str2, int len);
|
2008-01-27 15:00:04 +01:00
|
|
|
int STRING_compare(const char *str1, int len1, const char *str2, int len2);
|
|
|
|
int STRING_compare_ignore_case(const char *str1, int len1, const char *str2, int len2);
|
|
|
|
|
2011-09-07 14:38:29 +02:00
|
|
|
// valgrind says that STRING_equal_same() is globally faster than memcmp_sse4, so...
|
2008-01-27 15:00:04 +01:00
|
|
|
//#define STRING_equal_same(_str1, _str2, _len) (memcmp(_str1, _str2, _len) == 0)
|
|
|
|
#define STRING_equal(_str1, _len1, _str2, _len2) ((_len1) == (_len2) && STRING_equal_same(_str1, _str2, _len1))
|
2011-09-08 22:23:15 +02:00
|
|
|
#define STRING_equal_ignore_case(_str1, _len1, _str2, _len2) ((_len1) == (_len2) && STRING_equal_ignore_case_same(_str1, _str2, _len1))
|
2008-01-27 15:00:04 +01:00
|
|
|
|
|
|
|
#endif
|