/simpletypesystem/trunk

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/simpletypesystem/trunk

« back to all changes in this revision

Viewing changes to src/SimpleTypeSystem.c

  • Committer: Gustav Hartvigsson
  • Date: 2013-09-04 15:05:39 UTC
  • Revision ID: gustav.hartvigsson@gmail.com-20130904150539-7xfgt38hv5q3ycl2
Fixed a few things...
And added an error type...

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
 
 
2
#include "SimpleTypeSystem.h"
 
3
 
 
4
#include <stdlib.h>
 
5
#include <string.h>
 
6
 
 
7
char * s_get_version_string () {
 
8
  char * ret_val = malloc ( sizeof(char) * 32);
 
9
  sprintf (ret_val, "Version: %d.%d.%d ", s_get_version_major (),
 
10
                                           s_get_version_minor (),
 
11
                                           s_get_version_patch ());
 
12
  return ret_val;
 
13
}
 
14
 
 
15
int s_get_version_major () {
 
16
  return SIMPLE_TYPE_SYSTEM_VERSION_MAJOR;
 
17
}
 
18
 
 
19
int s_get_version_minor () {
 
20
  return SIMPLE_TYPE_SYSTEM_VERSION_MINOR;
 
21
}
 
22
 
 
23
int s_get_version_patch () {
 
24
  return SIMPLE_TYPE_SYSTEM_VERSION_PATCH;
 
25
}
 
26
 
 
27
char * s_string_new (const char * s) {
 
28
  char * ret_val = malloc (strlen (s) + 1);
 
29
  strcpy (ret_val, s);
 
30
  return ret_val;
 
31
}
 
32
 
 
33
char * s_string_new_with_lenghth (const char * s, size_t len) {
 
34
  char * ret_val = malloc (len);
 
35
  strncpy (ret_val, s, len);
 
36
  return ret_val;
 
37
}