First fromstr function implemented.
FossilOrigin-Name: b22bdf8b910513722aa8a699f22438d9ecf1567fd894876a412f759c160e2f07
This commit is contained in:
		| @ -30,6 +30,17 @@ static int mbag_strstr(void *item,char *dst) | ||||
|         return sprintf(dst, "%s", (char*)i->data); | ||||
| } | ||||
|  | ||||
| static struct mbag_item *  mbag_fromstr(const char *src) | ||||
| { | ||||
| 	struct mbag_item *i= malloc(sizeof(mbag_item_t)); | ||||
| 	if (!i) | ||||
| 		return NULL; | ||||
|  | ||||
| 	i->type = MBAG_STR; | ||||
| 	i->data = strdup(src); | ||||
| 	return i; | ||||
| } | ||||
|  | ||||
|  | ||||
|  | ||||
| const struct mbag_typedef mbag_type_byte = { | ||||
| @ -57,7 +68,7 @@ const struct mbag_typedef mbag_type_bstr16 = { | ||||
| }; | ||||
|  | ||||
| const struct mbag_typedef mbag_type_str = { | ||||
| 	"str",free,mbag_strstr | ||||
| 	"str",free,mbag_strstr,mbag_fromstr | ||||
| }; | ||||
|  | ||||
| const struct mbag_typedef mbag_type_vendorstr = { | ||||
|  | ||||
		Reference in New Issue
	
	Block a user