aboutsummaryrefslogtreecommitdiff
path: root/util
AgeCommit message (Collapse)Author
2016-06-05Use https instead of http where possibleDaniel Kahn Gillmor
Many of the external links found in the notmuch source can be resolved using https instead of http. This changeset addresses as many as i could find, without touching the e-mail corpus or expected outputs found in tests.
2015-09-26util: add strcmp_null, a strcmp that handles NULL parametersJani Nikula
Add strcmp_null, a strcmp that handles NULL strings; in strcmp terms a NULL string is considered to be less than a non-NULL string.
2015-09-07util: move strcase_equal and strcase_hash to utilJani Nikula
For future use in both cli and lib.
2014-10-05hex-escape: remove unused variable default_buf_sizeJani Nikula
Found by clang: CC -O2 util/hex-escape.o util/hex-escape.c:28:21: warning: unused variable 'default_buf_size' [-Wunused-const-variable] static const size_t default_buf_size = 1024; ^ 1 warning generated.
2014-08-06util: Const version of strtok_lenAustin Clements
Because of limitations in the C type system, we can't a strtok_len that can work on both const string and non-const strings. The C library solves this by taking a const char* and returning a char* in functions like this (e.g., strchr), but that's not const-safe. Solve it by introducing strtok_len_c, a version of strtok_len for const strings.
2014-07-31util: Make string-util.h C++-compatibleAustin Clements
2014-04-12util: add gz_readlineDavid Bremner
The idea is to provide a more or less drop in replacement for readline to read from zlib/gzip streams. Take the opportunity to replace malloc with talloc.
2014-03-15util: Fix two corner-cases in boolean term quoting functionAustin Clements
Previously, make_boolean_term did not quote empty boolean terms or boolean terms that started with '('. These cases are incompatible with Xapian: empty terms cannot be omitted, and boolean terms that start with '(' trigger an alternate term quoting syntax. Fix this by quoting empty terms and terms that contain '('.
2014-03-09util: make sanitize string available in string util for reuseJani Nikula
No functional changes.
2013-11-27util: detect byte orderDavid Bremner
Unfortunately old versions of GCC and clang do not provide byte order macros, so we re-invent them. If UTIL_BYTE_ORDER is not defined or defined to 0, we fall back to macros supported by recent versions of GCC and clang
2013-01-07string-util: Disallow empty prefixes in parse_boolean_termAustin Clements
Xapian doesn't consider ":abc" to be a prefixed term. This makes parse_boolean_term similarly reject queries with an empty prefix.
2013-01-06util: Function to parse boolean term queriesAustin Clements
This parses the subset of Xapian's boolean term quoting rules that are used by make_boolean_term. This is provided as a generic string utility, but will be used shortly in notmuch restore to parse and optimize for ID queries.
2013-01-06util: Factor out boolean term quoting routineAustin Clements
This is now a generic boolean term quoting function. It performs minimal quoting to produce user-friendly queries. This could live in tag-util as well, but it is really nothing specific to tags (although the conventions are specific to Xapian). The API is changed from "caller-allocates" to "readline-like". The scan for max tag length is pushed down into the quoting routine. Furthermore, this now combines the term prefix with the quoted term; arguably this is just as easy to do in the caller, but this will nicely parallel the boolean term parsing function to be introduced shortly. This is an amalgamation of code written by David Bremner and myself.
2012-12-30util: add talloc-extra.[ch]David Bremner
These are intended to be simple wrappers to provide slightly better debugging information than what talloc currently provides natively.
2012-12-08util: add string-util.[ch]David Bremner
This is to give a home to strtok_len. It's a bit silly to add a header for one routine, but it needs to be shared between several compilation units (or at least that's the most natural design).
2012-12-02hex-escape: (en|de)code strings to/from restricted character setDavid Bremner
The character set is chosen to be suitable for pathnames, and the same as that used by contrib/nmbug [With additions by Jani Nikula]
2012-09-27Annotate internal_error with the attribute noreturnJustus Winter
Annotating functions that do not return with the noreturn attribute (which is understood by both gcc and clang) prevents static analyzers from generating false positives (internal_error is used to terminate the process and is used extensively in error handling code paths). Remove the return statement that was placed there to appease the compiler. Functions annotated with noreturn are not supposed to return any values. Signed-off-by: Justus Winter <4winter@informatik.uni-hamburg.de>
2012-01-19Fix dependency generation for compat, test, and utilAustin Clements
This adds source files in compat, test, and util to SRCS so that the top-level Makefile.local will generate dependency files for them.
2011-12-12build-system: clean $(libutil_modules) rather than listing them individually.David Bremner
This matches the way the other 'Makefile.local's work.
2011-11-26build system: clean up object files in ./test and ./utilDavid Bremner
2011-10-31remove GCC visibility pragmasTomi Ollila
libnotmuch.so.* linking fail on some environments. According to David Bremner on irc: "We jump through hoops with the linker script (notmuch.sym) so the pragmas are not needed. And they are a little bizarre in a library anyway..."
2011-10-30xregcomp: don't consider every regex compilation failure an internal error.David Bremner
This pushes the error handling up one step, but makes the function more flexible. Running out of memory still triggers an internal error, in the spirit of other xutils functions.
2011-10-30xutil.c: remove duplicate copies, create new library libutil.a to contain xutil.David Bremner
We keep the lib/xutil.c version. As a consequence, also factor out _internal_error and associated macros. It might be overkill to make a new file error_util.c for this, but _internal_error does not really belong in database.cc.