kike: stuff

Implemented a lot of the channel stuff and other stuff as well.
This commit is contained in:
Přemysl Eric Janouch 2014-08-04 00:35:01 +02:00
parent 3291fd5c7a
commit 9bfdc741fe
2 changed files with 713 additions and 106 deletions

View File

@ -642,7 +642,7 @@ str_map_iter_next (struct str_map_iter *self)
self->link = self->link->next;
while (!self->link)
{
if (self->next_index >= map->len)
if (self->next_index >= map->alloc)
return NULL;
self->link = map->map[self->next_index++];
}
@ -1376,6 +1376,33 @@ strip_str_in_place (char *s, const char *stripped_chars)
return s;
}
static char *
join_str_vector (const struct str_vector *v, char delimiter)
{
if (!v->len)
return xstrdup ("");
struct str result;
str_init (&result);
str_append (&result, v->vector[0]);
for (size_t i = 1; i < v->len; i++)
str_append_printf (&result, "%c%s", delimiter, v->vector[i]);
return str_steal (&result);
}
ATTRIBUTE_PRINTF (1, 2)
static char *
xstrdup_printf (const char *format, ...)
{
va_list ap;
struct str tmp;
str_init (&tmp);
va_start (ap, format);
str_append_vprintf (&tmp, format, ap);
va_end (ap);
return str_steal (&tmp);
}
static bool
str_append_env_path (struct str *output, const char *var, bool only_absolute)
{

File diff suppressed because it is too large Load Diff