Librepo library  1.7.13
C library for downloading linux repository metadata and packages
 All Data Structures Functions Variables Typedefs Enumerations Enumerator Modules
util.h
1 /* librepo - A library providing (libcURL like) API to downloading repository
2  * Copyright (C) 2012 Tomas Mlcoch
3  *
4  * Licensed under the GNU Lesser General Public License Version 2.1
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2.1 of the License, or (at your option) any later version.
10  *
11  * This library 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 GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this library; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19  */
20 
21 #ifndef __LR_UTIL_H__
22 #define __LR_UTIL_H__
23 
24 #include <glib.h>
25 #include <stdlib.h>
26 #include <stdarg.h>
27 #include <curl/curl.h>
28 
29 #include "checksum.h"
30 #include "xmlparser.h"
31 
32 G_BEGIN_DECLS
33 
45 #define LR_CURL_VERSION_CHECK(major,minor,patch) \
46  (LIBCURL_VERSION_MAJOR > (major) || \
47  (LIBCURL_VERSION_MAJOR == (major) && LIBCURL_VERSION_MINOR > (minor)) || \
48  (LIBCURL_VERSION_MAJOR == (major) && LIBCURL_VERSION_MINOR == (minor) && \
49  LIBCURL_VERSION_PATCH >= (patch)))
50 
55 void lr_global_init();
56 
64 void lr_out_of_memory();
65 
70 void *lr_malloc(size_t len);
71 
76 void *lr_malloc0(size_t len);
77 
83 void *lr_realloc(void *ptr, size_t len);
84 
88 void lr_free(void *mem);
89 
93 int lr_gettmpfile();
94 
98 char *lr_gettmpdir();
99 
106 char *lr_pathconcat(const char *str, ...);
107 
112 int lr_remove_dir(const char *path);
113 
119 int lr_copy_content(int source, int dest);
120 
127 char *lr_prepend_url_protocol(const char *path);
128 
135 gchar *
136 lr_string_chunk_insert(GStringChunk *chunk, const gchar *string);
137 
141 int
143  char *msg,
144  void *cbdata,
145  GError **err G_GNUC_UNUSED) G_GNUC_UNUSED;
146 
147 
156 gboolean
157 lr_best_checksum(GSList *list, LrChecksumType *type, gchar **value);
158 
163 gchar *
164 lr_url_without_path(const char *url);
165 
172 gchar **
173 lr_strv_dup(gchar **array);
174 
177 G_END_DECLS
178 
179 #endif
gchar * lr_url_without_path(const char *url)
LrChecksumType
Definition: checksum.h:36
char * lr_pathconcat(const char *str,...)
int lr_gettmpfile()
void lr_free(void *mem)
char * lr_gettmpdir()
int lr_remove_dir(const char *path)
gchar ** lr_strv_dup(gchar **array)
void * lr_realloc(void *ptr, size_t len)
int lr_copy_content(int source, int dest)
int lr_xml_parser_warning_logger(LrXmlParserWarningType type G_GNUC_UNUSED, char *msg, void *cbdata, GError **err G_GNUC_UNUSED) G_GNUC_UNUSED
void lr_global_init()
gchar * lr_string_chunk_insert(GStringChunk *chunk, const gchar *string)
gboolean lr_best_checksum(GSList *list, LrChecksumType *type, gchar **value)
LrXmlParserWarningType
Definition: xmlparser.h:38
void * lr_malloc0(size_t len)
char * lr_prepend_url_protocol(const char *path)
void * lr_malloc(size_t len)
void lr_out_of_memory()