source: protocols/yahoo/yahoo_util.h @ 24de9fa

Last change on this file since 24de9fa was 5ebff60, checked in by dequis <dx@…>, at 2015-02-20T22:50:54Z

Reindent everything to K&R style with tabs

Used uncrustify, with the configuration file in ./doc/uncrustify.cfg

Commit author set to "Indent <please@…>" so that it's easier to
skip while doing git blame.

  • Property mode set to 100644
File size: 2.6 KB
RevLine 
[b7d3cc34]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
[6f10697]18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
[b7d3cc34]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
[5ebff60]32# define FREE(x)        if (x) { g_free(x); x = NULL; }
[b7d3cc34]33
[5ebff60]34# define y_new          g_new
35# define y_new0         g_new0
36# define y_renew        g_renew
[b7d3cc34]37
[5ebff60]38# define y_memdup       g_memdup
39# define y_strsplit     g_strsplit
40# define y_strfreev     g_strfreev
[b7d3cc34]41# ifndef strdup
[5ebff60]42#  define strdup        g_strdup
[b7d3cc34]43# endif
44# ifndef strncasecmp
[5ebff60]45#  define strncasecmp   g_strncasecmp
46#  define strcasecmp    g_strcasecmp
[b7d3cc34]47# endif
48
[5ebff60]49# define snprintf       g_snprintf
[25c4c78]50#ifdef vsnprintf
51#undef vsnprintf
52#endif
[5ebff60]53# define vsnprintf      g_vsnprintf
[b7d3cc34]54
55#else
56
57# include <stdlib.h>
58# include <stdarg.h>
59
[5ebff60]60# define FREE(x)                if (x) { free(x); x = NULL; }
[b7d3cc34]61
[5ebff60]62# define y_new(type, n)         (type *) malloc(sizeof(type) * (n))
63# define y_new0(type, n)        (type *) calloc((n), sizeof(type))
64# define y_renew(type, mem, n)  (type *) realloc(mem, n)
[b7d3cc34]65
[c36f73b]66void *y_memdup(const void *addr, int n);
67char **y_strsplit(char *str, char *sep, int nelem);
68void y_strfreev(char **vector);
[b7d3cc34]69
[c36f73b]70int strncasecmp(const char *s1, const char *s2, size_t n);
71int strcasecmp(const char *s1, const char *s2);
[b7d3cc34]72
[c36f73b]73char *strdup(const char *s);
[b7d3cc34]74
75int snprintf(char *str, size_t size, const char *format, ...);
76int vsnprintf(char *str, size_t size, const char *format, va_list ap);
77
78#endif
79
80#ifndef TRUE
81#define TRUE 1
82#endif
83
84#ifndef FALSE
85#define FALSE 0
86#endif
87
88#ifndef MIN
[5ebff60]89#define MIN(x, y) ((x) < (y) ? (x) : (y))
[b7d3cc34]90#endif
91
92#ifndef MAX
[5ebff60]93#define MAX(x, y) ((x) > (y) ? (x) : (y))
[b7d3cc34]94#endif
95
[5ebff60]96/*
[b7d3cc34]97 * The following three functions return newly allocated memory.
98 * You must free it yourself
99 */
[c36f73b]100char *y_string_append(char *str, char *append);
101char *y_str_to_utf8(const char *in);
102char *y_utf8_to_str(const char *in);
[b7d3cc34]103
104#endif
105
Note: See TracBrowser for help on using the repository browser.