1 /* ADG - Automatic Drawing Generation
2 * Copyright (C) 2007,2008,2009 Nicola Fontana <ntd at entidi.it>
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version.
9 * This library 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 GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the
16 * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 * Boston, MA 02110-1301, USA.
23 * @Section_Id:utilities
25 * @short_description: Assorted macros and functions
27 * Collection of macros and functions that do not fit inside any other topic.
32 * @id: The name of a struct
34 * Forward declaration of struct @id. It is equivalent to a typical
35 * struct forward declaration, for example:
38 * ADG_FORWARD_DECL(test)
44 * typedef struct _test test
47 * This macro is needed to fake <command>gtk-doc</command>, because
48 * up to now (v.1.12) it generates two conflicting links when using
49 * forward declarations: the first in the source with the declaration
50 * and the second where the type is defined. Using ADG_FORWARD_DECL()
51 * instead of the usual typedef avoids the parsing of the declaration
52 * in the first file (<command>gtk-doc</command> is not able to do C
55 * The same principle can be applied in the definition file. Following
56 * the previous example, you can use something like this where struct
61 * // This is declared in another file
62 * typedef struct _type type;
77 * @s1: first string to compare
78 * @s2: second string to compare
80 * A strcmp() function guarded against %NULL values. It works in the
81 * same way exept for the following situations:
84 * <listitem><code>s1 == NULL && s2 == NULL</code>: returns %0;</listitem>
85 * <listitem><code>s1 == NULL</code>: returns %INT_MIN;</listitem>
86 * <listitem><code>s2 == NULL</code>: returns %INT_MAX.</listitem>
89 * Returns: %0 if @s1 matches @s2, a value less than %0 if @s1 is less
90 * than @s2 or greather than %0 if @s1 is greather than @s2
93 adg_strcmp(const char *s1
, const char *s2
)
95 /* This will also catch the NULL == NULL case */
105 return strcmp(s1
, s2
);