]>
Commit | Line | Data |
---|---|---|
e64f5cd7 IB |
1 | /* |
2 | * name functionality | |
3 | */ | |
4 | ||
5 | #include "newsearch.h" | |
6 | ||
7 | #include <stdio.h> | |
8 | #include <stdlib.h> | |
9 | ||
c8be5183 CP |
10 | void *name_exe(searchCtx *ctx, struct searchNode *thenode, void *theinput); |
11 | void name_free(searchCtx *ctx, struct searchNode *thenode); | |
e64f5cd7 | 12 | |
f33f3f52 | 13 | struct searchNode *name_parse(searchCtx *ctx, int argc, char **argv) { |
e64f5cd7 IB |
14 | struct searchNode *thenode; |
15 | ||
e64f5cd7 IB |
16 | if (!(thenode=(struct searchNode *)malloc(sizeof(struct searchNode)))) { |
17 | /* couldn't malloc() memory for thenode, so free localdata to avoid leakage */ | |
18 | parseError = "malloc: could not allocate memory for this search."; | |
e64f5cd7 IB |
19 | return NULL; |
20 | } | |
21 | ||
c7f7a584 | 22 | thenode->returntype = RETURNTYPE_STRING; |
23 | thenode->localdata = NULL; | |
e64f5cd7 IB |
24 | thenode->exe = name_exe; |
25 | thenode->free = name_free; | |
26 | ||
27 | return thenode; | |
28 | } | |
29 | ||
c8be5183 | 30 | void *name_exe(searchCtx *ctx, struct searchNode *thenode, void *theinput) { |
e64f5cd7 | 31 | chanindex *cip = (chanindex *)theinput; |
e64f5cd7 | 32 | |
c7f7a584 | 33 | return cip->name->content; |
e64f5cd7 IB |
34 | } |
35 | ||
c8be5183 | 36 | void name_free(searchCtx *ctx, struct searchNode *thenode) { |
e64f5cd7 IB |
37 | free(thenode); |
38 | } | |
39 |