]> mj.ucw.cz Git - libucw.git/blobdiff - lib/stkstring.h
fixed support for 64bit big allocations
[libucw.git] / lib / stkstring.h
index 74e152888e8d2b9a4a2838d543c6076ffca978cd..dfead5acb3bc831cd955f117144ea135dfb6318f 100644 (file)
@@ -1,7 +1,7 @@
 /*
  *     UCW Library -- Strings Allocated on the Stack
  *
 /*
  *     UCW Library -- Strings Allocated on the Stack
  *
- *     (c) 2005--2006 Martin Mares <mj@ucw.cz>
+ *     (c) 2005--2007 Martin Mares <mj@ucw.cz>
  *     (c) 2005 Tomas Valla <tom@ucw.cz>
  *
  *     This software may be freely distributed and used according to the terms
  *     (c) 2005 Tomas Valla <tom@ucw.cz>
  *
  *     This software may be freely distributed and used according to the terms
@@ -10,6 +10,7 @@
 
 #include <alloca.h>
 #include <string.h>
 
 #include <alloca.h>
 #include <string.h>
+#include <stdio.h>
 
 #define stk_strdup(s) ({ char *_s=(s); uns _l=strlen(_s)+1; char *_x=alloca(_l); memcpy(_x, _s, _l); _x; })
 #define stk_strndup(s,n) ({ char *_s=(s); uns _l=strnlen(_s,(n)); char *_x=alloca(_l+1); memcpy(_x, _s, _l); _x[_l]=0; _x; })
 
 #define stk_strdup(s) ({ char *_s=(s); uns _l=strlen(_s)+1; char *_x=alloca(_l); memcpy(_x, _s, _l); _x; })
 #define stk_strndup(s,n) ({ char *_s=(s); uns _l=strnlen(_s,(n)); char *_x=alloca(_l+1); memcpy(_x, _s, _l); _x[_l]=0; _x; })
 #define stk_vprintf(f, args) ({ uns _l=stk_vprintf_internal(f, args); char *_x=alloca(_l); vsprintf(_x, f, args); _x; })
 #define stk_hexdump(s,n) ({ uns _n=(n); char *_x=alloca(3*_n+1); stk_hexdump_internal(_x,(byte*)(s),_n); _x; })
 #define stk_str_unesc(s) ({ byte *_s=(s); byte *_d=alloca(strlen(_s)+1); str_unesc(_d, _s); _d; })
 #define stk_vprintf(f, args) ({ uns _l=stk_vprintf_internal(f, args); char *_x=alloca(_l); vsprintf(_x, f, args); _x; })
 #define stk_hexdump(s,n) ({ uns _n=(n); char *_x=alloca(3*_n+1); stk_hexdump_internal(_x,(byte*)(s),_n); _x; })
 #define stk_str_unesc(s) ({ byte *_s=(s); byte *_d=alloca(strlen(_s)+1); str_unesc(_d, _s); _d; })
+#define stk_fsize(n) ({ char *_s=alloca(16); stk_fsize_internal(_s, n); _s; })
 
 uns stk_array_len(char **s, uns cnt);
 void stk_array_join(char *x, char **s, uns cnt, uns sep);
 uns stk_printf_internal(const char *x, ...) FORMAT_CHECK(printf,1,2);
 uns stk_vprintf_internal(const char *x, va_list args);
 void stk_hexdump_internal(char *dst, byte *src, uns n);
 
 uns stk_array_len(char **s, uns cnt);
 void stk_array_join(char *x, char **s, uns cnt, uns sep);
 uns stk_printf_internal(const char *x, ...) FORMAT_CHECK(printf,1,2);
 uns stk_vprintf_internal(const char *x, va_list args);
 void stk_hexdump_internal(char *dst, byte *src, uns n);
+void stk_fsize_internal(char *dst, u64 size);