]> git.notmuchmail.org Git - notmuch/blob - compat/compat.h
python: move Threads class into its own file
[notmuch] / compat / compat.h
1 /* notmuch - Not much of an email library, (just index and search)
2  *
3  * Copyright © 2009 Carl Worth
4  *
5  * This program is free software: you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation, either version 3 of the License, or
8  * (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program.  If not, see http://www.gnu.org/licenses/ .
17  *
18  * Author: Carl Worth <cworth@cworth.org>
19  */
20
21 /* This header file defines functions that will only be conditionally
22  * compiled for compatibility on systems that don't provide their own
23  * implementations of the functions.
24  */
25
26 #ifndef NOTMUCH_COMPAT_H
27 #define NOTMUCH_COMPAT_H
28
29 #ifdef __cplusplus
30 extern "C" {
31 #endif
32
33 #if !HAVE_GETLINE
34 #include <stdio.h>
35 #include <unistd.h>
36
37 ssize_t
38 getline (char **lineptr, size_t *n, FILE *stream);
39
40 ssize_t
41 getdelim (char **lineptr, size_t *n, int delimiter, FILE *fp);
42
43 #endif /* !HAVE_GETLINE */
44
45 #if !HAVE_STRCASESTR
46 char* strcasestr(const char *haystack, const char *needle);
47 #endif /* !HAVE_STRCASESTR */
48
49 /* Silence gcc warnings about unused results.  These warnings exist
50  * for a reason; any use of this needs to be justified. */
51 #ifdef __GNUC__
52 #define IGNORE_RESULT(x) ({ __typeof__(x) __z = (x); (void)(__z = __z); })
53 #else /* !__GNUC__ */
54 #define IGNORE_RESULT(x) x
55 #endif /* __GNUC__ */
56
57 #ifdef __cplusplus
58 }
59 #endif
60
61 #endif /* NOTMUCH_COMPAT_H */