}
char *
- mp_strjoin(struct mempool *p, char **a, uns n, uns sep)
+ mp_strjoin(struct mempool *p, char **a, uint n, uint sep)
{
- uint sizes[n];
- uint len = 1;
+ size_t sizes[n];
+ size_t len = 1;
- for (uns i=0; i<n; i++)
+ for (uint i=0; i<n; i++)
len += sizes[i] = strlen(a[i]);
if (sep && n)
len += n-1;
***/
/* For internal use only, do not call directly */
-void *mp_start_internal(struct mempool *pool, uint size) LIKE_MALLOC;
-void *mp_grow_internal(struct mempool *pool, uint size);
-void *mp_spread_internal(struct mempool *pool, void *p, uint size);
+void *mp_start_internal(struct mempool *pool, size_t size) LIKE_MALLOC;
+void *mp_grow_internal(struct mempool *pool, size_t size);
+void *mp_spread_internal(struct mempool *pool, void *p, size_t size);
- static inline uns mp_idx(struct mempool *pool, void *ptr)
+ static inline uint mp_idx(struct mempool *pool, void *ptr)
{
return ptr == pool->last_big;
}
/**
* Return size in bytes of the last allocated memory block (with @mp_alloc() or @mp_end()).
**/
-static inline uint mp_size(struct mempool *pool, void *ptr)
+static inline size_t mp_size(struct mempool *pool, void *ptr)
{
- uns idx = mp_idx(pool, ptr);
+ uint idx = mp_idx(pool, ptr);
return ((byte *)pool->state.last[idx] - (byte *)ptr) - pool->state.free[idx];
}
}
void
-mem_to_hex(char *dest, const byte *src, uint bytes, uint flags)
+mem_to_hex(char *dest, const byte *src, size_t bytes, uns flags)
{
- uns sep = flags & 0xff;
+ uint sep = flags & 0xff;
while (bytes--)
{
}
const char *
-hex_to_mem(byte *dest, const char *src, uint max_bytes, uint flags)
+hex_to_mem(byte *dest, const char *src, size_t max_bytes, uns flags)
{
- uns sep = flags & 0xff;
+ uint sep = flags & 0xff;
while (max_bytes-- && Cxdigit(src[0]) && Cxdigit(src[1]))
{
*dest++ = (hex_parse(src[0]) << 4) | hex_parse(src[1]);
* Format a set of flag bits. When the i-th bit of @flags is 1,
* set the i-th character of @dest to @fmt[i], otherwise to '-'.
**/
- char *str_format_flags(char *dest, const char *fmt, uns flags);
+ char *str_format_flags(char *dest, const char *fmt, uint flags);
/** Counts occurrences of @chr in @str. **/
-uint str_count_char(const char *str, uint chr);
+size_t str_count_char(const char *str, uns chr);
/* str-esc.c */