Mercurial > molko
changeset 87:ebbf35d90088
misc: fix several portability issues
author | David Demelier <markand@malikania.fr> |
---|---|
date | Wed, 11 Mar 2020 20:36:10 +0100 |
parents | 42fef6046300 |
children | 44de3c528b63 |
files | Makefile src/core/inventory.c src/core/sys.c |
diffstat | 3 files changed, 4 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/Makefile Wed Mar 11 19:55:33 2020 +0100 +++ b/Makefile Wed Mar 11 20:36:10 2020 +0100 @@ -90,6 +90,7 @@ TOOLS_OBJS= ${TOOLS:.c=} TOOLS_DEPS= ${TOOLS:.c=.d} +FLAGS= -MMD -D_XOPEN_SOURCE=700 DEFINES= -DPREFIX=\""${PREFIX}"\" \ -DBINDIR=\""${BINDIR}"\" \ -DSHAREDIR=\""${SHAREDIR}"\" @@ -103,10 +104,10 @@ -include ${CORE_DEPS} ${ADV_DEPS} ${TESTS_DEPS} ${TOOLS_DEPS} .c.o: - ${CC} ${DEFINES} ${INCLUDES} ${SDL_CFLAGS} ${CFLAGS} -MMD -c $< -o $@ + ${CC} ${FLAGS} ${DEFINES} ${INCLUDES} ${SDL_CFLAGS} ${CFLAGS} -MMD -c $< -o $@ .c: - ${CC} ${TESTS_INCS} -o $@ ${CFLAGS} $< ${TESTS_LIBS} ${SQLITE_LIB} + ${CC} ${FLAGS} ${TESTS_INCS} -o $@ ${CFLAGS} $< ${TESTS_LIBS} ${SQLITE_LIB} ${SQLITE_OBJ}: ${SQLITE_SRC} ${CC} ${CFLAGS} ${SQLITE_FLAGS} -c ${SQLITE_SRC} -o $@
--- a/src/core/inventory.c Wed Mar 11 19:55:33 2020 +0100 +++ b/src/core/inventory.c Wed Mar 11 20:36:10 2020 +0100 @@ -49,8 +49,6 @@ assert(iv); assert(item); - struct inventory_slot *slot = NULL; - /* First pass: find an entry with the same item. */ for (unsigned int r = 0; r < INVENTORY_ROWS_MAX; ++r) for (unsigned int c = 0; c < INVENTORY_COLS_MAX; ++c) @@ -108,7 +106,6 @@ while (amount) { struct inventory_slot *slot; - unsigned int avail; if (!(slot = find(iv, item))) break;
--- a/src/core/sys.c Wed Mar 11 19:55:33 2020 +0100 +++ b/src/core/sys.c Wed Mar 11 20:36:10 2020 +0100 @@ -161,7 +161,7 @@ char *pref; if ((pref = SDL_GetPrefPath("malikania", "molko"))) { - snprintf(path, sizeof (path), "%ssave-%u", idx); + snprintf(path, sizeof (path), "%ssave-%u", pref, idx); SDL_free(pref); } else snprintf(path, sizeof (path), "save-%u", idx);