source: protocols/yahoo/yahoo_util.h @ 4c225f0

Last change on this file since 4c225f0 was c36f73b, checked in by Wilmer van der Gaast <wilmer@…>, at 2010-07-23T14:35:45Z

This should mostly be a no-op, merging *loads* of whitespace changes from
libyahoo2 so that I can see better what really changed.

  • Property mode set to 100644
File size: 2.4 KB
Line 
1/*
2 * libyahoo2: yahoo_util.h
3 *
4 * Copyright (C) 2002-2004, Philip S Tellis <philip.tellis AT gmx.net>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
19 *
20 */
21
22#ifndef __YAHOO_UTIL_H__
23#define __YAHOO_UTIL_H__
24
25#if HAVE_CONFIG_H
26# include <config.h>
27#endif
28
29#if HAVE_GLIB
30# include <glib.h>
31
32# define FREE(x)        if(x) {g_free(x); x=NULL;}
33
34# define y_new          g_new
35# define y_new0         g_new0
36# define y_renew        g_renew
37
38# define y_memdup       g_memdup
39# define y_strsplit     g_strsplit
40# define y_strfreev     g_strfreev
41# ifndef strdup
42#  define strdup        g_strdup
43# endif
44# ifndef strncasecmp
45#  define strncasecmp   g_strncasecmp
46#  define strcasecmp    g_strcasecmp
47# endif
48
49# define snprintf       g_snprintf
50# define vsnprintf      g_vsnprintf
51
52#else
53
54# include <stdlib.h>
55# include <stdarg.h>
56
57# define FREE(x)                if(x) {free(x); x=NULL;}
58
59# define y_new(type, n)         (type *)malloc(sizeof(type) * (n))
60# define y_new0(type, n)        (type *)calloc((n), sizeof(type))
61# define y_renew(type, mem, n)  (type *)realloc(mem, n)
62
63void *y_memdup(const void *addr, int n);
64char **y_strsplit(char *str, char *sep, int nelem);
65void y_strfreev(char **vector);
66
67#ifndef _WIN32
68int strncasecmp(const char *s1, const char *s2, size_t n);
69int strcasecmp(const char *s1, const char *s2);
70
71char *strdup(const char *s);
72
73int snprintf(char *str, size_t size, const char *format, ...);
74int vsnprintf(char *str, size_t size, const char *format, va_list ap);
75#endif
76
77#endif
78
79#ifndef TRUE
80#define TRUE 1
81#endif
82
83#ifndef FALSE
84#define FALSE 0
85#endif
86
87#ifndef MIN
88#define MIN(x,y) ((x)<(y)?(x):(y))
89#endif
90
91#ifndef MAX
92#define MAX(x,y) ((x)>(y)?(x):(y))
93#endif
94
95/*
96 * The following three functions return newly allocated memory.
97 * You must free it yourself
98 */
99char *y_string_append(char *str, char *append);
100char *y_str_to_utf8(const char *in);
101char *y_utf8_to_str(const char *in);
102
103#endif
104
Note: See TracBrowser for help on using the repository browser.