ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/svn/ircd-hybrid/branches/8.2.x/src/conf_service.c
Revision: 9858
Committed: Fri Jan 1 04:43:42 2021 UTC (3 years, 2 months ago) by michael
Content type: text/x-csrc
File size: 1885 byte(s)
Log Message:
- Bump copyright years

File Contents

# Content
1 /*
2 * ircd-hybrid: an advanced, lightweight Internet Relay Chat Daemon (ircd)
3 *
4 * Copyright (c) 2012-2021 ircd-hybrid development team
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
19 * USA
20 */
21
22 /*! \file conf_service.c
23 * \brief Implements service {} block configuration management.
24 * \version $Id$
25 */
26
27 #include "stdinc.h"
28 #include "list.h"
29 #include "memory.h"
30 #include "conf_service.h"
31
32
33 static dlink_list service_list;
34
35
36 const dlink_list *
37 service_get_list(void)
38 {
39 return &service_list;
40 }
41
42 void
43 service_clear(void)
44 {
45 while (service_list.head)
46 {
47 struct ServiceItem *service = service_list.head->data;
48
49 dlinkDelete(&service->node, &service_list);
50 xfree(service->name);
51 xfree(service);
52 }
53 }
54
55 struct ServiceItem *
56 service_make(void)
57 {
58 struct ServiceItem *service = xcalloc(sizeof(*service));
59 dlinkAdd(service, &service->node, &service_list);
60
61 return service;
62 }
63
64 const struct ServiceItem *
65 service_find(const char *name, int (*compare)(const char *, const char *))
66 {
67 dlink_node *node;
68
69 DLINK_FOREACH(node, service_list.head)
70 {
71 const struct ServiceItem *service = node->data;
72
73 if (compare(service->name, name) == 0)
74 return service;
75 }
76
77 return NULL;
78 }

Properties

Name Value
svn:eol-style native
svn:keywords Id