Mercurial > sci
view util.h @ 2:5fa3d2f479b2
sci: initial upload support
author | David Demelier <markand@malikania.fr> |
---|---|
date | Thu, 10 Jun 2021 10:39:21 +0200 |
parents | 5afdb14df924 |
children | 215c0c3b3609 |
line wrap: on
line source
/* * util.h -- miscellaneous utilities * * Copyright (c) 2021 David Demelier <markand@malikania.fr> * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ #ifndef SCI_UTIL_H #define SCI_UTIL_H #include <stddef.h> #define UTIL_SIZE(x) (sizeof (x) / sizeof (x[0])) void * util_malloc(size_t); void * util_calloc(size_t, size_t); void * util_realloc(void *, size_t); void * util_reallocarray(void *, size_t, size_t); void * util_memdup(const void *, size_t); char * util_strdup(const char *); char * util_strndup(const char *, size_t); char * util_basename(const char *); char * util_dirname(const char *); size_t util_split(char *, const char **, size_t, char); char * util_printf(char *, size_t, const char *, ...); char * util_zbase64_enc(const char *); char * util_zbase64_dec(const char *); const char * util_path(const char *); #endif /* !SCI_UTIL_H */