aboutsummaryrefslogtreecommitdiff
path: root/hex.c
diff options
context:
space:
mode:
authorPřemysl Janouch <p.janouch@gmail.com>2017-01-23 23:18:55 +0100
committerPřemysl Janouch <p.janouch@gmail.com>2017-01-23 23:18:55 +0100
commit6d81ea596bebc41466a697c431481d6b862e9e1a (patch)
treeba435a5a616df12000439ee292f10a6d7e440497 /hex.c
parentfccfd1dd3b3e256db8759cfd6dba7cf6c3952e37 (diff)
downloadhex-6d81ea596bebc41466a697c431481d6b862e9e1a.tar.gz
hex-6d81ea596bebc41466a697c431481d6b862e9e1a.tar.xz
hex-6d81ea596bebc41466a697c431481d6b862e9e1a.zip
Bump liberty
Lots of stuff has been moved into it etc.
Diffstat (limited to 'hex.c')
-rw-r--r--hex.c27
1 files changed, 5 insertions, 22 deletions
diff --git a/hex.c b/hex.c
index 6756d8a..ffbf5b1 100644
--- a/hex.c
+++ b/hex.c
@@ -58,6 +58,7 @@ enum
#define LIBERTY_WANT_ASYNC
#define LIBERTY_WANT_PROTO_HTTP
#include "liberty/liberty.c"
+#include "liberty/liberty-tui.c"
#include <locale.h>
#include <termios.h>
@@ -65,7 +66,6 @@ enum
#include <sys/ioctl.h>
#endif // ! TIOCGWINSZ
-#include "tui.c"
#include "termo.h"
#ifdef HAVE_LUA
@@ -101,23 +101,6 @@ update_curses_terminal_size (void)
#endif // HAVE_RESIZETERM && TIOCGWINSZ
}
-// --- Simple array support ----------------------------------------------------
-
-// The most basic helper macros to make working with arrays not suck
-
-#define ARRAY(type, name) type *name; size_t name ## _len, name ## _size;
-#define ARRAY_INIT_SIZED(a, n) \
- BLOCK_START \
- (a) = xcalloc (sizeof *(a), (a ## _size) = (n)); \
- (a ## _len) = 0; \
- BLOCK_END
-#define ARRAY_INIT(a) ARRAY_INIT_SIZED (a, 16)
-#define ARRAY_RESERVE(a, n) \
- BLOCK_START \
- while ((a ## _size) - (a ## _len) < n) \
- (a) = xreallocarray ((a), sizeof *(a), (a ## _size) <<= 1); \
- BLOCK_END
-
// --- Application -------------------------------------------------------------
enum
@@ -1277,8 +1260,8 @@ app_lua_init (void)
luaL_setfuncs (g_ctx.L, app_lua_chunk_table, 0);
lua_pop (g_ctx.L, 1);
- struct str_vector v;
- str_vector_init (&v);
+ struct strv v;
+ strv_init (&v);
get_xdg_data_dirs (&v);
for (size_t i = 0; i < v.len; i++)
{
@@ -1287,7 +1270,7 @@ app_lua_init (void)
app_lua_load_plugins (path);
free (path);
}
- str_vector_free (&v);
+ strv_free (&v);
}
#endif // HAVE_LUA
@@ -1971,7 +1954,7 @@ main (int argc, char *argv[])
while (buf.len < (size_t) size_limit)
{
- str_ensure_space (&buf, 8192);
+ str_reserve (&buf, 8192);
ssize_t n_read = read (input_fd, buf.str + buf.len,
MIN (size_limit - buf.len, buf.alloc - buf.len));
if (!n_read)