Util/StringUtil: add StringStartsWith()

Replaces GLib's g_str_has_prefix().
This commit is contained in:
Max Kellermann 2013-11-28 18:48:35 +01:00
parent a788b7e747
commit af4133e3c9
16 changed files with 68 additions and 60 deletions

View File

@ -27,6 +27,7 @@
#include "tag/Tag.hxx" #include "tag/Tag.hxx"
#include "tag/TagSettings.h" #include "tag/TagSettings.h"
#include "fs/Charset.hxx" #include "fs/Charset.hxx"
#include "util/StringUtil.hxx"
#include "util/Error.hxx" #include "util/Error.hxx"
#include "Log.hxx" #include "Log.hxx"
@ -81,16 +82,16 @@ db_load_internal(TextFile &file, Directory &music_root, Error &error)
while ((line = file.ReadLine()) != nullptr && while ((line = file.ReadLine()) != nullptr &&
strcmp(line, DIRECTORY_INFO_END) != 0) { strcmp(line, DIRECTORY_INFO_END) != 0) {
if (g_str_has_prefix(line, DB_FORMAT_PREFIX)) { if (StringStartsWith(line, DB_FORMAT_PREFIX)) {
format = atoi(line + sizeof(DB_FORMAT_PREFIX) - 1); format = atoi(line + sizeof(DB_FORMAT_PREFIX) - 1);
} else if (g_str_has_prefix(line, DIRECTORY_MPD_VERSION)) { } else if (StringStartsWith(line, DIRECTORY_MPD_VERSION)) {
if (found_version) { if (found_version) {
error.Set(db_domain, "Duplicate version line"); error.Set(db_domain, "Duplicate version line");
return false; return false;
} }
found_version = true; found_version = true;
} else if (g_str_has_prefix(line, DIRECTORY_FS_CHARSET)) { } else if (StringStartsWith(line, DIRECTORY_FS_CHARSET)) {
const char *new_charset; const char *new_charset;
if (found_charset) { if (found_charset) {
@ -111,7 +112,7 @@ db_load_internal(TextFile &file, Directory &music_root, Error &error)
new_charset, old_charset); new_charset, old_charset);
return false; return false;
} }
} else if (g_str_has_prefix(line, DB_TAG_PREFIX)) { } else if (StringStartsWith(line, DB_TAG_PREFIX)) {
const char *name = line + sizeof(DB_TAG_PREFIX) - 1; const char *name = line + sizeof(DB_TAG_PREFIX) - 1;
TagType tag = tag_name_parse(name); TagType tag = tag_name_parse(name);
if (tag == TAG_NUM_OF_ITEM_TYPES) { if (tag == TAG_NUM_OF_ITEM_TYPES) {

View File

@ -24,6 +24,7 @@
#include "SongSave.hxx" #include "SongSave.hxx"
#include "PlaylistDatabase.hxx" #include "PlaylistDatabase.hxx"
#include "TextFile.hxx" #include "TextFile.hxx"
#include "util/StringUtil.hxx"
#include "util/NumberParser.hxx" #include "util/NumberParser.hxx"
#include "util/Error.hxx" #include "util/Error.hxx"
#include "util/Domain.hxx" #include "util/Domain.hxx"
@ -88,7 +89,7 @@ directory_load_subdir(TextFile &file, Directory &parent, const char *name,
return nullptr; return nullptr;
} }
if (g_str_has_prefix(line, DIRECTORY_MTIME)) { if (StringStartsWith(line, DIRECTORY_MTIME)) {
directory->mtime = directory->mtime =
ParseUint64(line + sizeof(DIRECTORY_MTIME) - 1); ParseUint64(line + sizeof(DIRECTORY_MTIME) - 1);
@ -100,7 +101,7 @@ directory_load_subdir(TextFile &file, Directory &parent, const char *name,
} }
} }
if (!g_str_has_prefix(line, DIRECTORY_BEGIN)) { if (!StringStartsWith(line, DIRECTORY_BEGIN)) {
error.Format(directory_domain, "Malformed line: %s", line); error.Format(directory_domain, "Malformed line: %s", line);
directory->Delete(); directory->Delete();
return nullptr; return nullptr;
@ -121,15 +122,15 @@ directory_load(TextFile &file, Directory &directory, Error &error)
const char *line; const char *line;
while ((line = file.ReadLine()) != nullptr && while ((line = file.ReadLine()) != nullptr &&
!g_str_has_prefix(line, DIRECTORY_END)) { !StringStartsWith(line, DIRECTORY_END)) {
if (g_str_has_prefix(line, DIRECTORY_DIR)) { if (StringStartsWith(line, DIRECTORY_DIR)) {
Directory *subdir = Directory *subdir =
directory_load_subdir(file, directory, directory_load_subdir(file, directory,
line + sizeof(DIRECTORY_DIR) - 1, line + sizeof(DIRECTORY_DIR) - 1,
error); error);
if (subdir == nullptr) if (subdir == nullptr)
return false; return false;
} else if (g_str_has_prefix(line, SONG_BEGIN)) { } else if (StringStartsWith(line, SONG_BEGIN)) {
const char *name = line + sizeof(SONG_BEGIN) - 1; const char *name = line + sizeof(SONG_BEGIN) - 1;
Song *song; Song *song;
@ -144,7 +145,7 @@ directory_load(TextFile &file, Directory &directory, Error &error)
return false; return false;
directory.AddSong(song); directory.AddSong(song);
} else if (g_str_has_prefix(line, PLAYLIST_META_BEGIN)) { } else if (StringStartsWith(line, PLAYLIST_META_BEGIN)) {
/* duplicate the name, because /* duplicate the name, because
playlist_metadata_load() will overwrite the playlist_metadata_load() will overwrite the
buffer */ buffer */

View File

@ -28,8 +28,7 @@
#include "OutputInternal.hxx" #include "OutputInternal.hxx"
#include "OutputError.hxx" #include "OutputError.hxx"
#include "Log.hxx" #include "Log.hxx"
#include "util/StringUtil.hxx"
#include <glib.h>
#include <assert.h> #include <assert.h>
#include <stdlib.h> #include <stdlib.h>
@ -61,7 +60,7 @@ audio_output_state_read(const char *line)
const char *name; const char *name;
struct audio_output *ao; struct audio_output *ao;
if (!g_str_has_prefix(line, AUDIO_DEVICE_STATE)) if (!StringStartsWith(line, AUDIO_DEVICE_STATE))
return false; return false;
line += sizeof(AUDIO_DEVICE_STATE) - 1; line += sizeof(AUDIO_DEVICE_STATE) - 1;

View File

@ -33,10 +33,9 @@
#include "ConfigOption.hxx" #include "ConfigOption.hxx"
#include "fs/Limits.hxx" #include "fs/Limits.hxx"
#include "util/CharUtil.hxx" #include "util/CharUtil.hxx"
#include "util/StringUtil.hxx"
#include "Log.hxx" #include "Log.hxx"
#include <glib.h>
#include <string.h> #include <string.h>
#include <stdlib.h> #include <stdlib.h>
@ -112,7 +111,7 @@ playlist_state_load(TextFile &file, struct playlist &playlist)
return; return;
} }
while (!g_str_has_prefix(line, PLAYLIST_STATE_FILE_PLAYLIST_END)) { while (!StringStartsWith(line, PLAYLIST_STATE_FILE_PLAYLIST_END)) {
queue_load_song(file, line, playlist.queue); queue_load_song(file, line, playlist.queue);
line = file.ReadLine(); line = file.ReadLine();
@ -135,7 +134,7 @@ playlist_state_restore(const char *line, TextFile &file,
int seek_time = 0; int seek_time = 0;
bool random_mode = false; bool random_mode = false;
if (!g_str_has_prefix(line, PLAYLIST_STATE_FILE_STATE)) if (!StringStartsWith(line, PLAYLIST_STATE_FILE_STATE))
return false; return false;
line += sizeof(PLAYLIST_STATE_FILE_STATE) - 1; line += sizeof(PLAYLIST_STATE_FILE_STATE) - 1;
@ -149,40 +148,40 @@ playlist_state_restore(const char *line, TextFile &file,
state = PlayerState::STOP; state = PlayerState::STOP;
while ((line = file.ReadLine()) != nullptr) { while ((line = file.ReadLine()) != nullptr) {
if (g_str_has_prefix(line, PLAYLIST_STATE_FILE_TIME)) { if (StringStartsWith(line, PLAYLIST_STATE_FILE_TIME)) {
seek_time = seek_time =
atoi(&(line[strlen(PLAYLIST_STATE_FILE_TIME)])); atoi(&(line[strlen(PLAYLIST_STATE_FILE_TIME)]));
} else if (g_str_has_prefix(line, PLAYLIST_STATE_FILE_REPEAT)) { } else if (StringStartsWith(line, PLAYLIST_STATE_FILE_REPEAT)) {
playlist.SetRepeat(pc, playlist.SetRepeat(pc,
strcmp(&(line[strlen(PLAYLIST_STATE_FILE_REPEAT)]), strcmp(&(line[strlen(PLAYLIST_STATE_FILE_REPEAT)]),
"1") == 0); "1") == 0);
} else if (g_str_has_prefix(line, PLAYLIST_STATE_FILE_SINGLE)) { } else if (StringStartsWith(line, PLAYLIST_STATE_FILE_SINGLE)) {
playlist.SetSingle(pc, playlist.SetSingle(pc,
strcmp(&(line[strlen(PLAYLIST_STATE_FILE_SINGLE)]), strcmp(&(line[strlen(PLAYLIST_STATE_FILE_SINGLE)]),
"1") == 0); "1") == 0);
} else if (g_str_has_prefix(line, PLAYLIST_STATE_FILE_CONSUME)) { } else if (StringStartsWith(line, PLAYLIST_STATE_FILE_CONSUME)) {
playlist.SetConsume(strcmp(&(line[strlen(PLAYLIST_STATE_FILE_CONSUME)]), playlist.SetConsume(strcmp(&(line[strlen(PLAYLIST_STATE_FILE_CONSUME)]),
"1") == 0); "1") == 0);
} else if (g_str_has_prefix(line, PLAYLIST_STATE_FILE_CROSSFADE)) { } else if (StringStartsWith(line, PLAYLIST_STATE_FILE_CROSSFADE)) {
pc.SetCrossFade(atoi(line + strlen(PLAYLIST_STATE_FILE_CROSSFADE))); pc.SetCrossFade(atoi(line + strlen(PLAYLIST_STATE_FILE_CROSSFADE)));
} else if (g_str_has_prefix(line, PLAYLIST_STATE_FILE_MIXRAMPDB)) { } else if (StringStartsWith(line, PLAYLIST_STATE_FILE_MIXRAMPDB)) {
pc.SetMixRampDb(atof(line + strlen(PLAYLIST_STATE_FILE_MIXRAMPDB))); pc.SetMixRampDb(atof(line + strlen(PLAYLIST_STATE_FILE_MIXRAMPDB)));
} else if (g_str_has_prefix(line, PLAYLIST_STATE_FILE_MIXRAMPDELAY)) { } else if (StringStartsWith(line, PLAYLIST_STATE_FILE_MIXRAMPDELAY)) {
const char *p = line + strlen(PLAYLIST_STATE_FILE_MIXRAMPDELAY); const char *p = line + strlen(PLAYLIST_STATE_FILE_MIXRAMPDELAY);
/* this check discards "nan" which was used /* this check discards "nan" which was used
prior to MPD 0.18 */ prior to MPD 0.18 */
if (IsDigitASCII(*p)) if (IsDigitASCII(*p))
pc.SetMixRampDelay(atof(p)); pc.SetMixRampDelay(atof(p));
} else if (g_str_has_prefix(line, PLAYLIST_STATE_FILE_RANDOM)) { } else if (StringStartsWith(line, PLAYLIST_STATE_FILE_RANDOM)) {
random_mode = random_mode =
strcmp(line + strlen(PLAYLIST_STATE_FILE_RANDOM), strcmp(line + strlen(PLAYLIST_STATE_FILE_RANDOM),
"1") == 0; "1") == 0;
} else if (g_str_has_prefix(line, PLAYLIST_STATE_FILE_CURRENT)) { } else if (StringStartsWith(line, PLAYLIST_STATE_FILE_CURRENT)) {
current = atoi(&(line current = atoi(&(line
[strlen [strlen
(PLAYLIST_STATE_FILE_CURRENT)])); (PLAYLIST_STATE_FILE_CURRENT)]));
} else if (g_str_has_prefix(line, } else if (StringStartsWith(line,
PLAYLIST_STATE_FILE_PLAYLIST_BEGIN)) { PLAYLIST_STATE_FILE_PLAYLIST_BEGIN)) {
playlist_state_load(file, playlist); playlist_state_load(file, playlist);
} }

View File

@ -26,13 +26,12 @@
#include "DatabasePlugin.hxx" #include "DatabasePlugin.hxx"
#include "DatabaseGlue.hxx" #include "DatabaseGlue.hxx"
#include "TextFile.hxx" #include "TextFile.hxx"
#include "util/StringUtil.hxx"
#include "util/UriUtil.hxx" #include "util/UriUtil.hxx"
#include "util/Error.hxx" #include "util/Error.hxx"
#include "fs/Traits.hxx" #include "fs/Traits.hxx"
#include "Log.hxx" #include "Log.hxx"
#include <glib.h>
#include <stdlib.h> #include <stdlib.h>
#define PRIO_LABEL "Prio: " #define PRIO_LABEL "Prio: "
@ -78,7 +77,7 @@ queue_load_song(TextFile &file, const char *line, queue &queue)
return; return;
uint8_t priority = 0; uint8_t priority = 0;
if (g_str_has_prefix(line, PRIO_LABEL)) { if (StringStartsWith(line, PRIO_LABEL)) {
priority = strtoul(line + sizeof(PRIO_LABEL) - 1, nullptr, 10); priority = strtoul(line + sizeof(PRIO_LABEL) - 1, nullptr, 10);
line = file.ReadLine(); line = file.ReadLine();
@ -89,7 +88,7 @@ queue_load_song(TextFile &file, const char *line, queue &queue)
const Database *db = nullptr; const Database *db = nullptr;
Song *song; Song *song;
if (g_str_has_prefix(line, SONG_BEGIN)) { if (StringStartsWith(line, SONG_BEGIN)) {
const char *uri = line + sizeof(SONG_BEGIN) - 1; const char *uri = line + sizeof(SONG_BEGIN) - 1;
if (!uri_has_scheme(uri) && !PathTraits::IsAbsoluteUTF8(uri)) if (!uri_has_scheme(uri) && !PathTraits::IsAbsoluteUTF8(uri))
return; return;

View File

@ -22,12 +22,11 @@
#include "MixerAll.hxx" #include "MixerAll.hxx"
#include "Idle.hxx" #include "Idle.hxx"
#include "GlobalEvents.hxx" #include "GlobalEvents.hxx"
#include "util/StringUtil.hxx"
#include "util/Domain.hxx" #include "util/Domain.hxx"
#include "system/PeriodClock.hxx" #include "system/PeriodClock.hxx"
#include "Log.hxx" #include "Log.hxx"
#include <glib.h>
#include <assert.h> #include <assert.h>
#include <stdlib.h> #include <stdlib.h>
@ -106,7 +105,7 @@ read_sw_volume_state(const char *line)
char *end = nullptr; char *end = nullptr;
long int sv; long int sv;
if (!g_str_has_prefix(line, SW_VOLUME_STATE)) if (!StringStartsWith(line, SW_VOLUME_STATE))
return false; return false;
line += sizeof(SW_VOLUME_STATE) - 1; line += sizeof(SW_VOLUME_STATE) - 1;

View File

@ -26,6 +26,7 @@
#include "tag/TagRva2.hxx" #include "tag/TagRva2.hxx"
#include "tag/TagHandler.hxx" #include "tag/TagHandler.hxx"
#include "CheckAudioFormat.hxx" #include "CheckAudioFormat.hxx"
#include "util/StringUtil.hxx"
#include "util/ASCII.hxx" #include "util/ASCII.hxx"
#include "util/Error.hxx" #include "util/Error.hxx"
#include "util/Domain.hxx" #include "util/Domain.hxx"
@ -689,7 +690,7 @@ parse_lame(struct lame *lame, struct mad_bitptr *ptr, int *bitlen)
/* This is technically incorrect, since the encoder might not be lame. /* This is technically incorrect, since the encoder might not be lame.
* But there's no other way to determine if this is a lame tag, and we * But there's no other way to determine if this is a lame tag, and we
* wouldn't want to go reading a tag that's not there. */ * wouldn't want to go reading a tag that's not there. */
if (!g_str_has_prefix(lame->encoder, "LAME")) if (!StringStartsWith(lame->encoder, "LAME"))
return false; return false;
if (sscanf(lame->encoder+4, "%u.%u", if (sscanf(lame->encoder+4, "%u.%u",

View File

@ -25,6 +25,7 @@
#include "CdioParanoiaInputPlugin.hxx" #include "CdioParanoiaInputPlugin.hxx"
#include "InputStream.hxx" #include "InputStream.hxx"
#include "InputPlugin.hxx" #include "InputPlugin.hxx"
#include "util/StringUtil.hxx"
#include "util/Error.hxx" #include "util/Error.hxx"
#include "util/Domain.hxx" #include "util/Domain.hxx"
#include "system/ByteOrder.hxx" #include "system/ByteOrder.hxx"
@ -117,7 +118,7 @@ struct cdio_uri {
static bool static bool
parse_cdio_uri(struct cdio_uri *dest, const char *src, Error &error) parse_cdio_uri(struct cdio_uri *dest, const char *src, Error &error)
{ {
if (!g_str_has_prefix(src, "cdda://")) if (!StringStartsWith(src, "cdda://"))
return false; return false;
src += 7; src += 7;

View File

@ -23,14 +23,13 @@
#include "InputStream.hxx" #include "InputStream.hxx"
#include "InputPlugin.hxx" #include "InputPlugin.hxx"
#include "tag/Tag.hxx" #include "tag/Tag.hxx"
#include "util/StringUtil.hxx"
#include "Log.hxx" #include "Log.hxx"
extern "C" { extern "C" {
#include <despotify.h> #include <despotify.h>
} }
#include <glib.h>
#include <unistd.h> #include <unistd.h>
#include <string.h> #include <string.h>
#include <errno.h> #include <errno.h>
@ -130,7 +129,7 @@ input_despotify_open(const char *url,
struct ds_link *ds_link; struct ds_link *ds_link;
struct ds_track *track; struct ds_track *track;
if (!g_str_has_prefix(url, "spt://")) if (!StringStartsWith(url, "spt://"))
return nullptr; return nullptr;
session = mpd_despotify_get_session(); session = mpd_despotify_get_session();

View File

@ -24,6 +24,7 @@
#include "FfmpegInputPlugin.hxx" #include "FfmpegInputPlugin.hxx"
#include "InputStream.hxx" #include "InputStream.hxx"
#include "InputPlugin.hxx" #include "InputPlugin.hxx"
#include "util/StringUtil.hxx"
#include "util/Error.hxx" #include "util/Error.hxx"
#include "util/Domain.hxx" #include "util/Domain.hxx"
@ -32,8 +33,6 @@ extern "C" {
#include <libavformat/avformat.h> #include <libavformat/avformat.h>
} }
#include <glib.h>
struct FfmpegInputStream { struct FfmpegInputStream {
InputStream base; InputStream base;
@ -90,12 +89,12 @@ input_ffmpeg_open(const char *uri,
Mutex &mutex, Cond &cond, Mutex &mutex, Cond &cond,
Error &error) Error &error)
{ {
if (!g_str_has_prefix(uri, "gopher://") && if (!StringStartsWith(uri, "gopher://") &&
!g_str_has_prefix(uri, "rtp://") && !StringStartsWith(uri, "rtp://") &&
!g_str_has_prefix(uri, "rtsp://") && !StringStartsWith(uri, "rtsp://") &&
!g_str_has_prefix(uri, "rtmp://") && !StringStartsWith(uri, "rtmp://") &&
!g_str_has_prefix(uri, "rtmpt://") && !StringStartsWith(uri, "rtmpt://") &&
!g_str_has_prefix(uri, "rtmps://")) !StringStartsWith(uri, "rtmps://"))
return nullptr; return nullptr;
AVIOContext *h; AVIOContext *h;

View File

@ -21,10 +21,10 @@
#include "MmsInputPlugin.hxx" #include "MmsInputPlugin.hxx"
#include "InputStream.hxx" #include "InputStream.hxx"
#include "InputPlugin.hxx" #include "InputPlugin.hxx"
#include "util/StringUtil.hxx"
#include "util/Error.hxx" #include "util/Error.hxx"
#include "util/Domain.hxx" #include "util/Domain.hxx"
#include <glib.h>
#include <libmms/mmsx.h> #include <libmms/mmsx.h>
struct MmsInputStream { struct MmsInputStream {
@ -58,10 +58,10 @@ input_mms_open(const char *url,
Mutex &mutex, Cond &cond, Mutex &mutex, Cond &cond,
Error &error) Error &error)
{ {
if (!g_str_has_prefix(url, "mms://") && if (!StringStartsWith(url, "mms://") &&
!g_str_has_prefix(url, "mmsh://") && !StringStartsWith(url, "mmsh://") &&
!g_str_has_prefix(url, "mmst://") && !StringStartsWith(url, "mmst://") &&
!g_str_has_prefix(url, "mmsu://")) !StringStartsWith(url, "mmsu://"))
return nullptr; return nullptr;
const auto mms = mmsx_connect(nullptr, nullptr, url, 128 * 1024); const auto mms = mmsx_connect(nullptr, nullptr, url, 128 * 1024);

View File

@ -19,11 +19,10 @@
#include "config.h" #include "config.h"
#include "ls.hxx" #include "ls.hxx"
#include "util/StringUtil.hxx"
#include "util/UriUtil.hxx" #include "util/UriUtil.hxx"
#include "Client.hxx" #include "Client.hxx"
#include <glib.h>
#include <assert.h> #include <assert.h>
/** /**
@ -90,7 +89,7 @@ bool uri_supported_scheme(const char *uri)
assert(uri_has_scheme(uri)); assert(uri_has_scheme(uri));
while (*urlPrefixes) { while (*urlPrefixes) {
if (g_str_has_prefix(uri, *urlPrefixes)) if (StringStartsWith(uri, *urlPrefixes))
return true; return true;
urlPrefixes++; urlPrefixes++;
} }

View File

@ -26,8 +26,6 @@
#include "util/StringUtil.hxx" #include "util/StringUtil.hxx"
#include "TextInputStream.hxx" #include "TextInputStream.hxx"
#include <glib.h>
#include <string.h> #include <string.h>
#include <stdlib.h> #include <stdlib.h>
@ -119,7 +117,7 @@ ExtM3uPlaylist::NextSong()
line_s = line.c_str(); line_s = line.c_str();
if (g_str_has_prefix(line_s, "#EXTINF:")) { if (StringStartsWith(line_s, "#EXTINF:")) {
delete tag; delete tag;
tag = extm3u_parse_tag(line_s + 8); tag = extm3u_parse_tag(line_s + 8);
continue; continue;

View File

@ -25,6 +25,7 @@
#include "InputStream.hxx" #include "InputStream.hxx"
#include "Song.hxx" #include "Song.hxx"
#include "tag/Tag.hxx" #include "tag/Tag.hxx"
#include "util/StringUtil.hxx"
#include "util/Error.hxx" #include "util/Error.hxx"
#include "util/Domain.hxx" #include "util/Domain.hxx"
#include "Log.hxx" #include "Log.hxx"
@ -65,9 +66,9 @@ static char *
soundcloud_resolve(const char* uri) { soundcloud_resolve(const char* uri) {
char *u, *ru; char *u, *ru;
if (g_str_has_prefix(uri, "http://")) { if (StringStartsWith(uri, "http://")) {
u = g_strdup(uri); u = g_strdup(uri);
} else if (g_str_has_prefix(uri, "soundcloud.com")) { } else if (StringStartsWith(uri, "soundcloud.com")) {
u = g_strconcat("http://", uri, nullptr); u = g_strconcat("http://", uri, nullptr);
} else { } else {
/* assume it's just a path on soundcloud.com */ /* assume it's just a path on soundcloud.com */

View File

@ -22,6 +22,7 @@
#include "ASCII.hxx" #include "ASCII.hxx"
#include <assert.h> #include <assert.h>
#include <string.h>
const char * const char *
strchug_fast(const char *p) strchug_fast(const char *p)
@ -32,6 +33,13 @@ strchug_fast(const char *p)
return p; return p;
} }
bool
StringStartsWith(const char *haystack, const char *needle)
{
const size_t length = strlen(needle);
return memcmp(haystack, needle, length) == 0;
}
bool bool
string_array_contains(const char *const* haystack, const char *needle) string_array_contains(const char *const* haystack, const char *needle)
{ {

View File

@ -40,6 +40,10 @@ strchug_fast(char *p)
return const_cast<char *>(strchug_fast((const char *)p)); return const_cast<char *>(strchug_fast((const char *)p));
} }
gcc_pure
bool
StringStartsWith(const char *haystack, const char *needle);
/** /**
* Checks whether a string array contains the specified string. * Checks whether a string array contains the specified string.
* *