Files
wget2/libwget/private.h
Akash Rawal e0b3dc1d26 Make wget_http_connection_t an abstract type
* include/wget/wget.h: Convert wget_http_connection_t to forward declaration
 * libwget/http.h: Move wget_http_connection_t definition here
 * libwget/Makefile.am: Add new file http.h
 * libwget/http.c: Include http.h and add accessor functions
 * libwget/http_highlevel.c: Include http.h
 * src/wget.c: Replace access to wget_http_connection_t with accessor function calls
2017-05-03 15:37:50 +02:00

72 lines
2.1 KiB
C

/*
* Copyright(c) 2012 Tim Ruehsen
* Copyright(c) 2015-2016 Free Software Foundation, Inc.
*
* This file is part of libwget.
*
* Libwget is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Libwget is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Libwget. If not, see <https://www.gnu.org/licenses/>.
*
*
* Header file for memory allocation routines
*
* Changelog
* 25.06.2012 Tim Ruehsen
*
*/
#ifndef _LIBWGET_PRIVATE_H
# define _LIBWGET_PRIVATE_H
# include <stdio.h> // needed for FILE
# include <stdlib.h> // needed for free()
# include <stdarg.h> // needed for va_list
// gnulib convenience header for libintl.h, turn of annoying warnings
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wundef"
#include <gettext.h>
#pragma GCC diagnostic pop
#ifdef ENABLE_NLS
# define _(STRING) gettext(STRING)
#else
# define _(STRING) STRING
#endif
// I try to never leave freed pointers hanging around
# define xfree(a) do { if (a) { free((void *)(a)); a=NULL; } } while (0)
// number of elements within an array
# define countof(a) (sizeof(a)/sizeof(*(a)))
// allow us to use wget_* functions without it's wget_ prefix within the library code
// #define _WGET_PREFIX wget_
//#define _WGET_CONCAT(a,b) a ## b
//#define _WGET_CONCAT2(a,b) _WGET_CONCAT(a,b)
// #define _GET_ADDPREFIX(a) _WGET_CONCAT2(_WGET_PREFIX,a)
// #define xmalloc _WGET_ADDPREFIX(xmalloc)
# define xmalloc wget_malloc
# define xcalloc wget_calloc
# define xrealloc wget_realloc
# define info_printf wget_info_printf
# define error_printf wget_error_printf
# define error_printf_exit wget_error_printf_exit
# define debug_printf wget_debug_printf
# define debug_write wget_debug_write
#endif /* _LIBWGET_PRIVATE_H */