mirror of
https://github.com/gbdev/rgbds.git
synced 2025-11-23 03:22:08 +00:00
Cleanup code of rgbfix, rgbgfx and external libs
Follow Linux kernel coding style. Signed-off-by: Antonio Niño Díaz <antonio_nd@outlook.com>
This commit is contained in:
25
include/extern/err.h
vendored
25
include/extern/err.h
vendored
@@ -2,10 +2,13 @@
|
||||
#define EXTERN_ERR_H
|
||||
|
||||
#ifdef ERR_IN_LIBC
|
||||
|
||||
#include <err.h>
|
||||
#else
|
||||
|
||||
#else /* ERR_IN_LIBC */
|
||||
|
||||
#include <stdarg.h>
|
||||
|
||||
#include "extern/stdnoreturn.h"
|
||||
|
||||
#define warn rgbds_warn
|
||||
@@ -18,16 +21,16 @@
|
||||
#define errx rgbds_errx
|
||||
#define verrx rgbds_verrx
|
||||
|
||||
void warn(const char *, ...);
|
||||
void vwarn(const char *, va_list);
|
||||
void warnx(const char *, ...);
|
||||
void vwarnx(const char *, va_list);
|
||||
void warn(const char *fmt, ...);
|
||||
void vwarn(const char *fmt, va_list ap);
|
||||
void warnx(const char *fmt, ...);
|
||||
void vwarnx(const char *fmt, va_list ap);
|
||||
|
||||
noreturn void err(int, const char *, ...);
|
||||
noreturn void verr(int, const char *, va_list);
|
||||
noreturn void errx(int, const char *, ...);
|
||||
noreturn void verrx(int, const char *, va_list);
|
||||
noreturn void err(int status, const char *fmt, ...);
|
||||
noreturn void verr(int status, const char *fmt, va_list ap);
|
||||
noreturn void errx(int status, const char *fmt, ...);
|
||||
noreturn void verrx(int status, const char *fmt, va_list ap);
|
||||
|
||||
#endif
|
||||
#endif /* ERR_IN_LIBC */
|
||||
|
||||
#endif
|
||||
#endif /* EXTERN_ERR_H */
|
||||
|
||||
9
include/extern/reallocarray.h
vendored
9
include/extern/reallocarray.h
vendored
@@ -2,13 +2,14 @@
|
||||
#define EXTERN_REALLOCARRAY_H
|
||||
|
||||
#ifdef REALLOCARRAY_IN_LIBC
|
||||
|
||||
#include <stdlib.h>
|
||||
#else
|
||||
|
||||
#else /* REALLOCARRAY_IN_LIBC */
|
||||
|
||||
#define reallocarray rgbds_reallocarray
|
||||
|
||||
void *reallocarray(void *, size_t, size_t);
|
||||
|
||||
#endif
|
||||
#endif /* REALLOCARRAY_IN_LIBC */
|
||||
|
||||
#endif
|
||||
#endif /* EXTERN_REALLOCARRAY_H */
|
||||
|
||||
25
include/extern/stdnoreturn.h
vendored
25
include/extern/stdnoreturn.h
vendored
@@ -1,16 +1,21 @@
|
||||
#ifndef EXTERN_STDNORETURN_H
|
||||
#define EXTERN_STDNORETURN_H
|
||||
|
||||
#if __STDC_VERSION__ >= 201112L
|
||||
/* C11 or newer */
|
||||
#define noreturn _Noreturn
|
||||
/* C11 or newer */
|
||||
#define noreturn _Noreturn
|
||||
#elif __cplusplus >= 201103L
|
||||
/* C++11 or newer */
|
||||
#define noreturn [[noreturn]]
|
||||
/* C++11 or newer */
|
||||
#define noreturn [[noreturn]]
|
||||
#elif __GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ >= 5))
|
||||
/* GCC 2.5 or newer */
|
||||
#define noreturn __attribute__ ((noreturn))
|
||||
/* GCC 2.5 or newer */
|
||||
#define noreturn __attribute__ ((noreturn))
|
||||
#elif _MSC_VER >= 1310
|
||||
/* MS Visual Studio 2003/.NET Framework 1.1 or newer */
|
||||
#define noreturn _declspec( noreturn)
|
||||
/* MS Visual Studio 2003/.NET Framework 1.1 or newer */
|
||||
#define noreturn _declspec(noreturn)
|
||||
#else
|
||||
/* unsupported, but no need to throw a fit */
|
||||
#define noreturn
|
||||
/* Unsupported, but no need to throw a fit */
|
||||
#define noreturn
|
||||
#endif
|
||||
|
||||
#endif /* EXTERN_STDNORETURN_H */
|
||||
|
||||
18
include/extern/strl.h
vendored
18
include/extern/strl.h
vendored
@@ -1,13 +1,17 @@
|
||||
#ifndef STRL_H
|
||||
#define STRL_H
|
||||
#ifndef EXTERN_STRL_H
|
||||
#define EXTERN_STRL_H
|
||||
|
||||
#ifdef STRL_IN_LIBC
|
||||
|
||||
#include <string.h>
|
||||
#else
|
||||
|
||||
#else /* STRL_IN_LIBC */
|
||||
|
||||
#define strlcpy rgbds_strlcpy
|
||||
#define strlcat rgbds_strlcat
|
||||
size_t strlcpy(char *, const char *, size_t);
|
||||
size_t strlcat(char *, const char *, size_t);
|
||||
#endif
|
||||
size_t strlcpy(char *dst, const char *src, size_t dsize);
|
||||
size_t strlcat(char *dst, const char *src, size_t dsize);
|
||||
|
||||
#endif
|
||||
#endif /* STRL_IN_LIBC */
|
||||
|
||||
#endif /* EXTERN_STRL_H */
|
||||
|
||||
7
include/extern/version.h
vendored
7
include/extern/version.h
vendored
@@ -14,8 +14,13 @@
|
||||
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef EXTERN_VERSION_H
|
||||
#define EXTERN_VERSION_H
|
||||
|
||||
#define PACKAGE_VERSION_MAJOR (0)
|
||||
#define PACKAGE_VERSION_MINOR (3)
|
||||
#define PACKAGE_VERSION_PATCH (3)
|
||||
|
||||
const char * get_package_version_string(void);
|
||||
const char *get_package_version_string(void);
|
||||
|
||||
#endif /* EXTERN_VERSION_H */
|
||||
|
||||
@@ -20,11 +20,14 @@
|
||||
#include <stdint.h>
|
||||
#include "gfx/main.h"
|
||||
|
||||
void png_to_gb(struct PNGImage png, struct GBImage *gb);
|
||||
void output_file(struct Options opts, struct GBImage gb);
|
||||
int get_tile_index(uint8_t *tile, uint8_t **tiles, int num_tiles, int tile_size);
|
||||
void create_tilemap(struct Options opts, struct GBImage *gb, struct Tilemap *tilemap);
|
||||
void output_tilemap_file(struct Options opts, struct Tilemap tilemap);
|
||||
void output_palette_file(struct Options opts, struct PNGImage png);
|
||||
void png_to_gb(const struct PNGImage png, struct GBImage *gb);
|
||||
void output_file(const struct Options opts, const struct GBImage gb);
|
||||
int get_tile_index(uint8_t *tile, uint8_t **tiles, int num_tiles,
|
||||
int tile_size);
|
||||
void create_tilemap(const struct Options opts, struct GBImage *gb,
|
||||
struct Tilemap *tilemap);
|
||||
void output_tilemap_file(const struct Options opts,
|
||||
const struct Tilemap tilemap);
|
||||
void output_palette_file(const struct Options opts, const struct PNGImage png);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -72,4 +72,4 @@ int depth, colors;
|
||||
#include "gfx/makepng.h"
|
||||
#include "gfx/gb.h"
|
||||
|
||||
#endif
|
||||
#endif /* RGBDS_GFX_MAIN_H */
|
||||
|
||||
@@ -19,10 +19,10 @@
|
||||
|
||||
#include "gfx/main.h"
|
||||
|
||||
void input_png_file(struct Options opts, struct PNGImage *img);
|
||||
void input_png_file(const struct Options opts, struct PNGImage *img);
|
||||
void get_text(struct PNGImage *png);
|
||||
void set_text(struct PNGImage *png);
|
||||
void output_png_file(struct Options opts, struct PNGImage *png);
|
||||
void free_png_data(struct PNGImage *png);
|
||||
void set_text(const struct PNGImage *png);
|
||||
void output_png_file(const struct Options opts, const struct PNGImage *png);
|
||||
void free_png_data(const struct PNGImage *png);
|
||||
|
||||
#endif
|
||||
#endif /* RGBDS_GFX_PNG_H */
|
||||
|
||||
Reference in New Issue
Block a user