summaryrefslogtreecommitdiff
path: root/src/apk_atom.h
blob: 1b6ad6c9670a42eff2d1a30d88439f98de4e0108 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
/* apk_atom.h - Alpine Package Keeper (APK)
 *
 * Copyright (C) 2005-2008 Natanael Copa <n@tanael.org>
 * Copyright (C) 2008-2020 Timo Teräs <timo.teras@iki.fi>
 * All rights reserved.
 *
 * SPDX-License-Identifier: GPL-2.0-only
 */

#ifndef APK_ATOM_H
#define APK_ATOM_H

#include "apk_hash.h"
#include "apk_blob.h"

extern apk_blob_t apk_atom_null;

struct apk_atom_pool {
	struct apk_hash hash;
};

void apk_atom_init(struct apk_atom_pool *);
void apk_atom_free(struct apk_atom_pool *);
apk_blob_t *apk_atom_get(struct apk_atom_pool *atoms, apk_blob_t blob, int duplicate);

static inline apk_blob_t *apk_atomize(struct apk_atom_pool *atoms, apk_blob_t blob) {
	return apk_atom_get(atoms, blob, 0);
}
static inline apk_blob_t *apk_atomize_dup(struct apk_atom_pool *atoms, apk_blob_t blob) {
	return apk_atom_get(atoms, blob, 1);
}

#endif