ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/svn/ircd-hybrid/trunk/src/conf_service.c
Revision: 9101
Committed: Wed Jan 1 09:58:45 2020 UTC (5 years, 7 months ago) by michael
Content type: text/x-csrc
File size: 1885 byte(s)
Log Message:
- Bump copyright years everywhere

File Contents

# User Rev Content
1 michael 7248 /*
2     * ircd-hybrid: an advanced, lightweight Internet Relay Chat Daemon (ircd)
3     *
4 michael 9101 * Copyright (c) 2012-2020 ircd-hybrid development team
5 michael 7248 *
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 michael 7312 * \version $Id$
25 michael 7248 */
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 michael 7259 xfree(service->name);
51 michael 7248 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 michael 8433 service_find(const char *name, int (*compare)(const char *, const char *))
66 michael 7248 {
67     dlink_node *node;
68    
69     DLINK_FOREACH(node, service_list.head)
70     {
71     const struct ServiceItem *service = node->data;
72    
73 michael 8603 if (compare(service->name, name) == 0)
74 michael 7248 return service;
75     }
76    
77     return NULL;
78     }

Properties

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