return NULL;
}
- Bookmark *item = g_new0(Bookmark, 1);
+ Bookmark *item = g_slice_new0(Bookmark);
parts = g_strsplit(line, "\t", 3);
len = g_strv_length(parts);
g_free(bm->uri);
g_free(bm->title);
g_strfreev(bm->tags);
- g_free(bm);
+ g_slice_free(Bookmark, bm);
}
gboolean ex_run_string(const char *input)
{
- ExArg *arg = g_new0(ExArg, 1);
+ ExArg *arg = g_slice_new0(ExArg);
arg->lhs = g_string_new("");
arg->rhs = g_string_new("");
if (arg->rhs) {
g_string_free(arg->rhs, true);
}
- g_free(arg);
+ g_slice_free(ExArg, arg);
}
static gboolean ex_bookmark(const ExArg *arg)
/* skipt the first : */
in++;
- ExArg *arg = g_new0(ExArg, 1);
+ ExArg *arg = g_slice_new0(ExArg);
skip_whitespace(&in);
parse_count(&in, arg);
return NULL;
}
- History *item = g_new0(History, 1);
+ History *item = g_slice_new0(History);
parts = g_strsplit(line, "\t", 2);
len = g_strv_length(parts);
{
g_free(item->first);
g_free(item->second);
- g_free(item);
+ g_slice_free(History, item);
}
if (max_age == 0) {
remove_host_entry(provider, host);
} else {
- entry = g_new(HSTSEntry, 1);
+ entry = g_slice_new(HSTSEntry);
entry->expires_at = soup_date_new_from_now(max_age);
entry->include_sub_domains = include_sub_domains;
static void free_entry(HSTSEntry *entry)
{
soup_date_free(entry->expires_at);
- g_free(entry);
+ g_slice_free(HSTSEntry, entry);
}
/**
include_sub_domains = (*parts[2] == 'y') ? true : false;
/* built the new entry to add */
- entry = g_new(HSTSEntry, 1);
+ entry = g_slice_new(HSTSEntry);
entry->expires_at = soup_date_new_from_string(parts[1]);
entry->include_sub_domains = include_sub_domains;
/* disable the active element */
dom_editable_element_set_disable(active, true);
- EditorData *data = g_new0(EditorData, 1);
+ EditorData *data = g_slice_new0(EditorData);
data->file = file_path;
data->element = active;
g_unlink(data->file);
g_free(data->file);
- g_free(data);
+ g_slice_free(EditorData, data);
g_spawn_close_pid(pid);
}
/* if lhs was already mapped, remove this first */
map_delete_by_lhs(lhs, inlen, mode);
- Map *new = g_new(Map, 1);
+ Map *new = g_slice_new(Map);
new->in = lhs;
new->inlen = inlen;
new->mapped = rhs;
{
g_free(map->in);
g_free(map->mapped);
- g_free(map);
+ g_slice_free(Map, map);
}
static GHashTable *modes = NULL;
extern VbCore vb;
+static void free_mode(Mode *mode);
+
+
void mode_init(void)
{
- modes = g_hash_table_new_full(g_direct_hash, g_direct_equal, NULL, g_free);
+ modes = g_hash_table_new_full(g_direct_hash, g_direct_equal, NULL, (GDestroyNotify)free_mode);
}
void mode_cleanup(void)
void mode_add(char id, ModeTransitionFunc enter, ModeTransitionFunc leave,
ModeKeyFunc keypress, ModeInputChangedFunc input_changed)
{
- Mode *new = g_new(Mode, 1);
+ Mode *new = g_slice_new(Mode);
new->id = id;
new->enter = enter;
new->leave = leave;
g_free(text);
}
}
+
+static void free_mode(Mode *mode)
+{
+ g_slice_free(Mode, mode);
+}