aboutsummaryrefslogtreecommitdiffstats
path: root/src/util/StringUtil.hxx (unfollow)
Commit message (Collapse)AuthorFilesLines
2014-03-01java: new helper library for the Android portMax Kellermann1-0/+14
2014-02-18util/StringUtil: add StringEndsWith()Max Kellermann1-0/+4
Replaces g_str_has_suffix().
2014-02-17util/StringUtil: add function Strip()Max Kellermann1-0/+7
Replaces g_strstrip().
2014-01-13copyright year 2014Max Kellermann1-1/+1
2013-11-28Util/StringUtil: add StringStartsWith()Max Kellermann1-0/+4
Replaces GLib's g_str_has_prefix().
2013-10-18util/StringUtil: rename strchug_fast_c() to strchug_fast()Max Kellermann1-5/+2
Overload the name.
2013-10-15gcc.h: rename to Compiler.hMax Kellermann1-1/+1
2013-08-07*: remove remaining __cplusplus checksMax Kellermann1-23/+1
2013-04-09string_util: convert to C++Max Kellermann1-13/+4
2013-04-09OpusReader: don't use strndup()Max Kellermann1-26/+0
Eliminate the fallback strndup() and strnlen() implementations.
2013-01-27string_util: add fallback for strnlen()Max Kellermann1-0/+8
Usually, when strndup() is not available, strndup() isn't either, because both are POSIX 2008.
2013-01-11string_util.c: provide fallback strndup() implementationDenis Krjuchkov1-0/+26
This patch also adds extern "C" { } wrapper around string_util.h to allow its usage in C++ code
2013-01-02string_util: use const_cast in C++ modeMax Kellermann1-0/+4
2012-08-02gcc.h: re-add gcc_const and gcc_pureMax Kellermann1-4/+4
Remove GLib dependency from some headers.
2011-01-29copyright year 2011Max Kellermann1-1/+1
2010-12-23string_util: add function strchug_fast()Max Kellermann1-0/+41
Replace g_strchug() calls with a cheaper implementation.
2010-12-23utils: move string_array_contains() to string_util.cMax Kellermann1-13/+2
2009-12-31Update copyright notices.Avuton Olrich1-1/+1
2009-11-08utils: removed function set_nonblocking()Max Kellermann1-2/+0
It's not used anymore, its features have been moved to fd_util.c.
2009-11-06utils: renamed stringFoundInStringArray()Max Kellermann1-1/+12
No CamelCase. Use bool instead of int. Make both arguments mandatory.
2009-03-13all: Update copyright header.Avuton Olrich1-6/+7
This updates the copyright header to all be the same, which is pretty much an update of where to mail request for a copy of the GPL and the years of the MPD project. This also puts all committers under 'The Music Player Project' umbrella. These entries should go individually in the AUTHORS file, for consistancy.
2009-02-19utils: use g_usleep() instead of my_usleep()Max Kellermann1-2/+0
Now that I've found this nice function in the GLib docs, we can finally remove our custom sleep function. Still all those callers of g_usleep() have to be migrated one day to use events, instead of regular polling.
2009-01-03utils: removed unused functionsMax Kellermann1-57/+0
Removed all allocation functions, xwrite(), xread(), ARRAY_SIZE(). Those have been superseded by GLib.
2009-01-03tag: use g_strescape() to eliminate evil charactersMax Kellermann1-2/+0
This always allocates strings on the heap, but we can delete the stripReturnChar() function now.
2009-01-03listen: use GLib instead of utils.hMax Kellermann1-2/+0
2008-12-30main_notify: make the read side of the pipe blockingMax Kellermann1-2/+0
Currently, both sides of the pipe are blocking, although we do not need blocking read(). Convert it back to blocking. Eliminate the select() from wait_main_task().
2008-12-28Remove xpthread_* wrappersThomas Jansen1-9/+0
2008-12-28utils: removed myFgets()Max Kellermann1-2/+0
Replaced myFgets() with fgets() + g_strchomp().
2008-12-09utils: moving stringFoundInStringArray() from decoder into utilsViliam Mateicka1-0/+2
2008-12-02replaced mpd_malloc by G_GNUC_MALLOCThomas Jansen1-6/+5
We want to remove gcc.h eventually. This takes care of all the G_GNUC_MALLOC macros.
2008-11-22utils: introduce assert_static()Laszlo Ashin1-0/+9
assert_static() will help us to find false asserts in compile time. Of course it only works in case of expressions which can be evaluated compile time. It cannot be used in global scope.
2008-11-01utils: use GUINT32_FROM_LE() instead of readLEuint32()Max Kellermann1-2/+0
Eliminate code already provided by GLib.
2008-10-31added prefix to header macrosMax Kellermann1-2/+2
"LOG_H" is a macro which is also used by ffmpeg/log.h. This is ffmpeg's fault, because short macros should be reserved for applications, but since it's always a good idea to choose prefixed macro names, even for applications, we are going to do that in MPD.
2008-10-29log: don't use utils.hMax Kellermann1-2/+0
Prefer GLib over utils.h.
2008-10-28utils: use g_str_has_prefix() instead of prefixcmp()Max Kellermann1-2/+0
Remove duplicated code from MPD.
2008-10-15locate: use g_utf8_casefold() instead of string_toupper()Max Kellermann1-4/+0
string_toupper() and strDupToUpper() were not able to deal with character sets other than US-ASCII. Use GLib's g_utf8_casefold() for strings.
2008-10-08don't include os_compat.hMax Kellermann1-1/+6
When there are standardized headers, use these instead of the bloated os_compat.h.
2008-09-23Add prefixcmp() (stol^H^H^H^Hborrowed from git)Eric Wong1-0/+2
This allows us to avoid the nasty repetition in strncmp(foo, bar, strlen(foo)). We'll miss out on the compiler optimizing strlen() into sizeof() - 1 for string literals for this; but we don't use this it for performance-critical functions anyways...
2008-08-29added xfree() which takes a const pointerMax Kellermann1-0/+13
Unfortunately, the C standard postulates that the argument to free() must be non-const. This does not makes sense, and virtually prevents every pointer which must be freed at some time to be non-const. Use the deconst hack (sorry for that) to allow us to free constant pointers.
2008-06-30utils: pthread_{mutex,cond}_init can fail, so check for itEric Wong1-0/+4
git-svn-id: https://svn.musicpd.org/mpd/trunk@7394 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2008-06-30utils: add new unforgiving utility functionsEric Wong1-0/+6
We'll be using pipes when waiting for I/O, and condition variables at other times. git-svn-id: https://svn.musicpd.org/mpd/trunk@7391 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2008-04-12clean up CPP includesMax Kellermann1-1/+0
Try to only include headers which are really needed. We should particularly check all "headers including other headers". The long-term goal is to have a manageable, small API for plugins (decoders, output) without so many mpd internals cluttering the namespace. git-svn-id: https://svn.musicpd.org/mpd/trunk@7319 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2008-03-26notify: cleanupsEric Wong1-0/+2
* move set_nonblock{,ing}() into utils.c since we use it elsewhere, too * add proper error checking to set_nonblocking() * use os_compat.h instead of individually #includ-ing system headers git-svn-id: https://svn.musicpd.org/mpd/trunk@7217 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2008-01-03Cleanup #includes of standard system headers and put them in one placeEric Wong1-8/+1
This will make refactoring features easier, especially now that pthreads support and larger refactorings are on the horizon. Hopefully, this will make porting to other platforms (even non-UNIX-like ones for masochists) easier, too. os_compat.h will house all the #includes for system headers considered to be the "core" of MPD. Headers for optional features will be left to individual source files. git-svn-id: https://svn.musicpd.org/mpd/trunk@7130 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2007-12-28Merge branches/ew r7104Eric Wong1-1/+3
thread-safety work in preparation for rewrite to use pthreads Expect no regressions against trunk (r7078), possibly minor performance improvements in update (due to fewer heap allocations), but increased stack usage. Applied the following patches: * maxpath_str for reentrancy (temporary fix, reverted) * path: start working on thread-safe variants of these methods * Re-entrancy work on path/character-set conversions * directory.c: exploreDirectory() use reentrant functions here * directory/update: more use of reentrant functions + cleanups * string_toupper: a strdup-less version of strDupToUpper * get_song_url: a static-variable-free version of getSongUrl() * Use reentrant/thread-safe get_song_url everywhere * replace rmp2amp with the reentrant version, rmp2amp_r * Get rid of the non-reentrant/non-thread-safe rpp2app, too. * buffer2array: assert strdup() returns a usable value in unit tests * replace utf8ToFsCharset and fsCharsetToUtf8 with thread-safe variants * fix storing playlists w/o absolute paths * parent_path(), a reentrant version of parentPath() * parentPath => parent_path for reentrancy and thread-safety * allow "make test" to automatically run embedded unit tests * remove convStrDup() and maxpath_str() * use MPD_PATH_MAX everywhere instead of MAXPATHLEN * path: get rid of appendSlash, pfx_path and just use pfx_dir * get_song_url: fix the ability to play songs in the top-level music_directory git-svn-id: https://svn.musicpd.org/mpd/trunk@7106 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2007-06-13Adding parsePath and making parseConfigFilePath use it.J. Alexander Treuman1-0/+2
git-svn-id: https://svn.musicpd.org/mpd/trunk@6622 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2007-04-05The massive copyright updateAvuton Olrich1-1/+1
git-svn-id: https://svn.musicpd.org/mpd/trunk@5834 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-08-26Replace strdup and {c,re,m}alloc with x* variants to check for OOM errorsEric Wong1-0/+9
I'm checking for zero-size allocations and assert()-ing them, so we can more easily get backtraces and debug problems, but we'll also allow -DNDEBUG people to live on the edge if they wish. We do not rely on errno when checking for OOM errors because some implementations of malloc do not set it, and malloc is commonly overridden by userspace wrappers. I've spent some time looking through the source and didn't find any obvious places where we would explicitly allocate 0 bytes, so we shouldn't trip any of those assertions. We also avoid allocating zero bytes because C libraries don't handle this consistently (some return NULL, some not); and it's dangerous either way. git-svn-id: https://svn.musicpd.org/mpd/trunk@4690 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-08-22get rid of the pointless xopen wrapper, open(2) does not throw errno = EINTREric Wong1-7/+0
git-svn-id: https://svn.musicpd.org/mpd/trunk@4663 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-08-20Fix warnings for -Wmissing-prototypesAvuton Olrich1-1/+1
Add -Wmissing-prototypes if compiling with gcc Static where possible git-svn-id: https://svn.musicpd.org/mpd/trunk@4657 09075e82-0dd4-0310-85a5-a0d7c8717e4f