2 * Copyright (C) 2007 by INdT
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public License
6 * as published by the Free Software Foundation; either version 2
7 * of the License, or (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 * @author Gustavo Sverzut Barbieri <gustavo.barbieri@openbossa.org>
21 #ifndef _LIGHTMEDIASCANNER_UTILS_H_
22 #define _LIGHTMEDIASCANNER_UTILS_H_ 1
30 # define API __attribute__ ((visibility("default")))
34 # if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)
35 # define GNUC_NON_NULL(...) __attribute__((nonnull(__VA_ARGS__)))
37 # define GNUC_NON_NULL(...)
41 # define GNUC_NON_NULL(...)
49 struct lms_string_size {
54 #define LMS_STATIC_STRING_SIZE(s) {s, sizeof(s) - 1}
55 #define LMS_ARRAY_SIZE(a) (sizeof(a) / sizeof(*a))
58 API void lms_strstrip(char *str, unsigned int *p_len) GNUC_NON_NULL(1, 2);
59 API void lms_strstrip_and_free(char **p_str, unsigned int *p_len) GNUC_NON_NULL(1, 2);
60 API void lms_string_size_strip_and_free(struct lms_string_size *p) GNUC_NON_NULL(1);
61 API int lms_which_extension(const char *name, unsigned int name_len, const struct lms_string_size *exts, unsigned int exts_len) GNUC_NON_NULL(1, 3);
68 #endif /* _LIGHTMEDIASCANNER_UTILS_H_ */