Librepo library  1.7.18
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 
63 void lr_log_librepo_summary(void);
64 
68 void lr_out_of_memory();
69 
74 void *lr_malloc(size_t len);
75 
80 void *lr_malloc0(size_t len);
81 
87 void *lr_realloc(void *ptr, size_t len);
88 
92 void lr_free(void *mem);
93 
97 int lr_gettmpfile();
98 
102 char *lr_gettmpdir();
103 
110 char *lr_pathconcat(const char *str, ...) G_GNUC_NULL_TERMINATED;
111 
116 int lr_remove_dir(const char *path);
117 
123 int lr_copy_content(int source, int dest);
124 
131 char *lr_prepend_url_protocol(const char *path);
132 
139 gchar *
140 lr_string_chunk_insert(GStringChunk *chunk, const gchar *string);
141 
145 int
147  char *msg,
148  void *cbdata,
149  GError **err G_GNUC_UNUSED) G_GNUC_UNUSED;
150 
151 
160 gboolean
161 lr_best_checksum(GSList *list, LrChecksumType *type, gchar **value);
162 
167 gchar *
168 lr_url_without_path(const char *url);
169 
176 gchar **
177 lr_strv_dup(gchar **array);
178 
179 
187 gboolean
188 lr_is_local_path(const gchar *path);
189 
198 gboolean
199 lr_key_file_save_to_file(GKeyFile *key_file,
200  const gchar *filename,
201  GError **error);
202 
205 G_END_DECLS
206 
207 #endif
gchar * lr_url_without_path(const char *url)
LrChecksumType
Definition: checksum.h:36
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)
gboolean lr_is_local_path(const gchar *path)
gboolean lr_key_file_save_to_file(GKeyFile *key_file, const gchar *filename, GError **error)
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)
void lr_log_librepo_summary(void)
char * lr_pathconcat(const char *str,...) G_GNUC_NULL_TERMINATED
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()