/* Optimized string comparison.
Copyright (C) 2001-2002, 2007, 2009-2010 Free Software Foundation, Inc.
under the terms of the GNU General Public License as published
by the Free Software Foundation; either version 3 of the License, or
(at your option) 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
Lesser General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
/* Written by Bruno Haible <bruno@clisp.org>. */
#ifndef _GL_STREQ_H
#define _GL_STREQ_H
#include <string.h>
/* STREQ allows to optimize string comparison with a small literal string.
STREQ (s, "EUC-KR", 'E', 'U', 'C', '-', 'K', 'R', 0, 0, 0)
is semantically equivalent to
strcmp (s, "EUC-KR") == 0
just faster. */
/* Help GCC to generate good code for string comparisons with
immediate strings. */
#if defined (__GNUC__) && defined (__OPTIMIZE__)
static inline int
{
}
static inline int
{
{
if (s28 == 0)
return 1;
else
}
else
return 0;
}
static inline int
{
{
if (s27 == 0)
return 1;
else
}
else
return 0;
}
static inline int
{
{
if (s26 == 0)
return 1;
else
}
else
return 0;
}
static inline int
{
{
if (s25 == 0)
return 1;
else
}
else
return 0;
}
static inline int
{
{
if (s24 == 0)
return 1;
else
}
else
return 0;
}
static inline int
{
{
if (s23 == 0)
return 1;
else
}
else
return 0;
}
static inline int
streq2 (const char *s1, const char *s2, char s22, char s23, char s24, char s25, char s26, char s27, char s28)
{
{
if (s22 == 0)
return 1;
else
}
else
return 0;
}
static inline int
streq1 (const char *s1, const char *s2, char s21, char s22, char s23, char s24, char s25, char s26, char s27, char s28)
{
{
if (s21 == 0)
return 1;
else
}
else
return 0;
}
static inline int
streq0 (const char *s1, const char *s2, char s20, char s21, char s22, char s23, char s24, char s25, char s26, char s27, char s28)
{
{
if (s20 == 0)
return 1;
else
}
else
return 0;
}
#else
#endif
#endif /* _GL_STREQ_H */