strset: use GLib instead of utils.h
This commit is contained in:
parent
906ca3e204
commit
3dc43bb915
@ -17,10 +17,10 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "strset.h"
|
#include "strset.h"
|
||||||
#include "utils.h"
|
|
||||||
|
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
#define NUM_SLOTS 16384
|
#define NUM_SLOTS 16384
|
||||||
|
|
||||||
@ -51,7 +51,7 @@ static unsigned calc_hash(const char *p) {
|
|||||||
|
|
||||||
G_GNUC_MALLOC struct strset *strset_new(void)
|
G_GNUC_MALLOC struct strset *strset_new(void)
|
||||||
{
|
{
|
||||||
struct strset *set = xcalloc(1, sizeof(*set));
|
struct strset *set = g_new0(struct strset, 1);
|
||||||
return set;
|
return set;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -93,7 +93,7 @@ void strset_add(struct strset *set, const char *value)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
/* insert it into the slot chain */
|
/* insert it into the slot chain */
|
||||||
slot = xmalloc(sizeof(*slot));
|
slot = g_new(struct strset_slot, 1);
|
||||||
slot->next = base_slot->next;
|
slot->next = base_slot->next;
|
||||||
slot->value = value;
|
slot->value = value;
|
||||||
base_slot->next = slot;
|
base_slot->next = slot;
|
||||||
|
Loading…
Reference in New Issue
Block a user