OSDN Git Service

2013.10.24
[uclinux-h8/uClinux-dist.git] / user / ser / mod_fix.h
1 /*
2  *$Id: mod_fix.h,v 1.1 2004/09/27 03:11:08 jiri Exp $
3  *
4  */
5
6
7 #ifndef _modfix_h
8 #define _modfix_h
9
10 #include "mem/mem.h"
11 #include "str.h"
12 #include "error.h"
13
14
15 /*  
16  * Convert char* parameter to str* parameter   
17  */
18 static int str_fixup(void** param, int param_no)
19 {
20         str* s;
21         
22         if (param_no == 1 || param_no == 2 ) {
23                 s = (str*)pkg_malloc(sizeof(str));
24                 if (!s) {
25                         LOG(L_ERR, "str_fixup(): No memory left\n");
26                         return E_UNSPEC;
27                 }
28                 
29                 s->s = (char*)*param;
30                 s->len = strlen(s->s);
31                 *param = (void*)s;
32         }
33         
34         return 0;
35 }
36
37 #endif