#include <unistd.h>
#include <string.h>
#include <zlib.h>
+#include <dragonport/asprintf.h>
#include "map.h"
#include "util.h"
return result;
}
-// convert #RRGGBB color to v3f32
-v3f32 html_to_v3f32(const char *html)
-{
- unsigned int r, g, b;
- sscanf(html, "#%2x%2x%2x", &r, &g, &b);
- return (v3f32) {(f32) r / 255.0f, (f32) g / 255.0f, (f32) b / 255.0f};
-}
-
// compress data using ZLib and store result(buffer allocated by malloc) in compressed
void my_compress(const void *uncompressed, size_t uncompressed_size, char **compressed, size_t *compressed_size)
{
{
return v < min ? min : v > max ? max : v;
}
+
+char *format_string(const char *format, ...)
+{
+ va_list args;
+ va_start(args, format);
+ char *ptr;
+ vasprintf(&ptr, format, args);
+ va_end(args);
+ return ptr;
+}