1 /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
3 * Copyright (C) 2000-2012 Jeffrey Stedfast
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public License
7 * as published by the Free Software Foundation; either version 2.1
8 * of the License, or (at your option) any later version.
10 * This library 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 GNU
13 * Lesser General Public License for more details.
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this library; if not, write to the Free
17 * Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA
28 #include "gmime-table-private.h"
29 #include "gmime-common.h"
32 #define g_tolower(x) (((x) >= 'A' && (x) <= 'Z') ? (x) - 'A' + 'a' : (x))
36 g_mime_strcase_equal (gconstpointer v, gconstpointer v2)
38 return g_ascii_strcasecmp ((const char *) v, (const char *) v2) == 0;
43 g_mime_strcase_hash (gconstpointer key)
49 h = (h << 5) - h + g_tolower (*p);
59 * @str: The string to duplicate and trim
61 * Duplicates the given input string while also trimming leading and
62 * trailing whitespace.
64 * Returns a duplicate string, minus any leading and trailing
65 * whitespace that the original string may have contained.
68 g_mime_strdup_trim (const char *str)
70 register const char *inptr = str;
71 register const char *end;
74 while (is_lwsp (*inptr))
81 if (!is_lwsp (*inptr++))
85 return g_strndup (start, (size_t) (end - start));