ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/ermyth/src/symbolmatrix.C
Revision: 1.1
Committed: Thu Jul 19 08:24:59 2007 UTC (16 years, 10 months ago) by pippijn
Content type: text/plain
Branch: MAIN
Log Message:
initial import. the most important changes since Atheme are:
- fixed many memory leaks
- fixed many bugs
- converted to C++ and use more STL containers
- added a (not very enhanced yet) perl module
- greatly improved XML-RPC speed
- added a JSON-RPC module with code from json-cpp
- added a valgrind memcheck module to operserv
- added a more object oriented base64 implementation
- added a specialised unit test framework
- improved stability
- use gettimeofday() if available
- reworked adding/removing commands
- MemoServ IGNORE DEL can now remove indices

File Contents

# Content
1 /*
2 * symbolmatrix.C: Module symbol management.
3 * Rights to this code are documented in doc/LICENSE.
4 *
5 * Copyright © 2005-2007 Atheme Project (http://www.atheme.org)
6 */
7
8 static char const rcsid[] = "$Id";
9
10 #include "atheme.h"
11
12 void *
13 module_symbol_get (module_t *mod, module_symbol_t * sym)
14 {
15 return_val_if_fail (mod != NULL, NULL);
16 return_val_if_fail (sym != NULL, NULL);
17 return_val_if_fail (sym->sym != NULL, NULL);
18
19 /* XXX sym->mod->header->name is wrong. :( */
20 sym->mod = mod;
21 sym->addr = module_locate_symbol (sym->mod->header->name, sym->sym);
22
23 return sym->addr;
24 }
25
26 int
27 module_symbol_getn (module_symbol_source_t * map, size_t n)
28 {
29 int i;
30
31 return_val_if_fail (map != NULL, -1);
32 return_val_if_fail (n > 0, -1);
33
34 for (i = 0; i < n; i++)
35 {
36 module_t *m = module_find_published (map[i].mod);
37 map[i].sym.sym = map[i].symn;
38
39 /* handle failed lookups. */
40 if (module_symbol_get (m, &map[i].sym) == NULL)
41 i--;
42 }
43
44 return i;
45 }