dpkg 1.21.11
namevalue.h
Go to the documentation of this file.
1/*
2 * libdpkg - Debian packaging suite library routines
3 * namevalue.h - name value structure handling
4 *
5 * Copyright © 1994,1995 Ian Jackson <ijackson@chiark.greenend.org.uk>
6 * Copyright © 2009-2012, 2015 Guillem Jover <guillem@debian.org>
7 *
8 * This is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
12 *
13 * This is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program. If not, see <https://www.gnu.org/licenses/>.
20 */
21
22#ifndef LIBDPKG_NAMEVALUE_H
23#define LIBDPKG_NAMEVALUE_H
24
25#include <dpkg/macros.h>
26
28
35struct namevalue {
36 const char *name;
37 int value;
38 int length;
39};
40
41#define NAMEVALUE_DEF(n, v) \
42 [v] = { .name = n, .value = v, .length = sizeof(n) - 1 }
43
44const struct namevalue *namevalue_find_by_name(const struct namevalue *head,
45 const char *str);
46
50
51#endif /* LIBDPKG_NAMEVALUE_H */
#define DPKG_BEGIN_DECLS
Definition: macros.h:86
#define DPKG_END_DECLS
Definition: macros.h:87
const struct namevalue * namevalue_find_by_name(const struct namevalue *head, const char *str)
Definition: namevalue.c:30
Definition: namevalue.h:35
int length
Definition: namevalue.h:38
const char * name
Definition: namevalue.h:36
int value
Definition: namevalue.h:37
struct trigfileint * head
Definition: triglib.c:415