util.c File Reference

#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <sys/time.h>
#include "util.h"

Go to the source code of this file.

Classes

struct  sat_sort_data

Defines

#define _GNU_SOURCE

Functions

void sat_oom (size_t num, size_t len)
void * sat_malloc (size_t len)
 malloc exits with error message on error
void * sat_malloc2 (size_t num, size_t len)
void * sat_realloc (void *old, size_t len)
void * sat_realloc2 (void *old, size_t num, size_t len)
void * sat_calloc (size_t num, size_t len)
void * sat_free (void *mem)
unsigned int sat_timems (unsigned int subtract)
static int sat_sort_helper (void *compard, const void *a, const void *b)
void sat_sort (void *base, size_t nmemb, size_t size, int(*compar)(const void *, const void *, void *), void *compard)
char * sat_dupjoin (const char *str1, const char *str2, const char *str3)
char * sat_dupappend (const char *str1, const char *str2, const char *str3)
int sat_hex2bin (const char **strp, unsigned char *buf, int bufl)
char * sat_bin2hex (const unsigned char *buf, int l, char *str)


Define Documentation

#define _GNU_SOURCE

Definition at line 8 of file util.c.


Function Documentation

void sat_oom ( size_t  num,
size_t  len 
)

Definition at line 19 of file util.c.

Referenced by sat_calloc(), sat_malloc(), sat_malloc2(), sat_realloc(), and sat_realloc2().

void* sat_malloc ( size_t  len  ) 

malloc exits with error message on error

Definition at line 30 of file util.c.

References sat_oom().

Referenced by map_init_clone(), pool_addfileprovides_dep(), pool_id2langid(), repo_add_solv_flags(), sat_dupjoin(), and sat_malloc2().

void* sat_malloc2 ( size_t  num,
size_t  len 
)

void* sat_realloc ( void *  old,
size_t  len 
)

void* sat_realloc2 ( void *  old,
size_t  num,
size_t  len 
)

void* sat_calloc ( size_t  num,
size_t  len 
)

void* sat_free ( void *  mem  ) 

unsigned int sat_timems ( unsigned int  subtract  ) 

static int sat_sort_helper ( void *  compard,
const void *  a,
const void *  b 
) [static]

Definition at line 133 of file util.c.

References sat_sort_data::compar, and sat_sort_data::compard.

Referenced by sat_sort().

void sat_sort ( void *  base,
size_t  nmemb,
size_t  size,
int(*)(const void *, const void *, void *)  compar,
void *  compard 
)

Definition at line 140 of file util.c.

References sat_sort_data::compar, sat_sort_data::compard, and sat_sort_helper().

char* sat_dupjoin ( const char *  str1,
const char *  str2,
const char *  str3 
)

Definition at line 151 of file util.c.

References sat_malloc().

Referenced by sat_dupappend().

char* sat_dupappend ( const char *  str1,
const char *  str2,
const char *  str3 
)

Definition at line 179 of file util.c.

References sat_dupjoin(), and sat_free().

int sat_hex2bin ( const char **  strp,
unsigned char *  buf,
int  bufl 
)

Definition at line 187 of file util.c.

char* sat_bin2hex ( const unsigned char *  buf,
int  l,
char *  str 
)

Definition at line 222 of file util.c.


doxygen