Import source to librtti
Summary: - Import initial source Test Plan: NA
This commit is contained in:
commit
c8c1749347
23 changed files with 969 additions and 0 deletions
23
src/str.c
Normal file
23
src/str.c
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
#include <errno.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "rtti.h"
|
||||
|
||||
char* toString(var v, ...)
|
||||
{
|
||||
to_string_fn_t method = NULL;
|
||||
va_list ap;
|
||||
char* s = NULL;
|
||||
|
||||
RTTI_GET_METHOD(method, v, toString, toString);
|
||||
if (method == NULL) {
|
||||
errno = -EINVAL;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
va_start(ap, v);
|
||||
s = method(v, ap);
|
||||
va_end(ap);
|
||||
|
||||
return s;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue