bzr branch
http://gegoxaren.bato24.eu/bzr/simpletypesystem/trunk
|
3
by Gustav Hartvigsson
Fixed a few things... |
1 |
#include "SimpleTypeSystem.h" |
2 |
||
3 |
#include <stdlib.h> |
|
4 |
#include <string.h> |
|
5 |
||
6 |
char * s_get_version_string () { |
|
7 |
char * ret_val = malloc ( sizeof(char) * 32); |
|
8 |
sprintf (ret_val, "Version: %d.%d.%d ", s_get_version_major (), |
|
9 |
s_get_version_minor (), |
|
10 |
s_get_version_patch ()); |
|
11 |
return ret_val; |
|
12 |
}
|
|
13 |
||
14 |
int s_get_version_major () { |
|
15 |
return SIMPLE_TYPE_SYSTEM_VERSION_MAJOR; |
|
16 |
}
|
|
17 |
||
18 |
int s_get_version_minor () { |
|
19 |
return SIMPLE_TYPE_SYSTEM_VERSION_MINOR; |
|
20 |
}
|
|
21 |
||
22 |
int s_get_version_patch () { |
|
23 |
return SIMPLE_TYPE_SYSTEM_VERSION_PATCH; |
|
24 |
}
|
|
25 |
||
26 |
char * s_string_new (const char * s) { |
|
27 |
char * ret_val = strdup (s); |
|
|
5.2.2
by Gustav Hartvigsson
Made sure -- using valgrind -- that the SBaseObjectInstance and |
28 |
free (s); |
29 |
return ret_val; |
|
|
3
by Gustav Hartvigsson
Fixed a few things... |
30 |
}
|
31 |
||
32 |
char * s_string_new_with_len (const char * s, size_t len) { |
|
|
5.2.1
by Gustav Hartvigsson
Started work on the Map (SMap) data structure. |
33 |
char * ret_val = malloc (len + 1); |
34 |
strncpy (ret_val, s, len); |
|
|
3
by Gustav Hartvigsson
Fixed a few things... |
35 |
free (s); |
|
5.2.2
by Gustav Hartvigsson
Made sure -- using valgrind -- that the SBaseObjectInstance and |
36 |
return ret_val; |
|
3
by Gustav Hartvigsson
Fixed a few things... |
37 |
}
|
38 |
||
|
5.2.1
by Gustav Hartvigsson
Started work on the Map (SMap) data structure. |
39 |
void s_print (const char * string) { |
40 |
fprintf (stdout, string); |
|
41 |
}
|
|
42 |