/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-06 15:05:32 UTC
  • mfrom: (5.2.4 simple_type_system_SMap)
  • Revision ID: gustav.hartvigsson@gmail.com-20130906150532-tudew69vmiljy1t6
* Merged the still unfinished SMap impleementation,
* TODO:
       To build a working SMap the system must determin whether or not an
       object is a child to SBaseObjectInstance or not.

       This is a non-trivial thing to do, and req. a lot of base work:
         A lookup table for objects is needed, with appropriet functions
         and probobly a main-loop.

Show diffs side-by-side

added added

removed removed

Lines of Context:
25
25
}
26
26
 
27
27
char * s_string_new (const char * s) {
28
 
  char * ret_val = malloc (strlen (s) + 1);
29
 
  strcpy (ret_val, s);
 
28
  char * ret_val = strdup (s);
 
29
  free (s);
30
30
  return ret_val;
31
31
}
32
32
 
33
 
char * s_string_new_with_lenghth (const char * s, size_t len) {
34
 
  char * ret_val = malloc (len);
 
33
char * s_string_new_with_len (const char * s, size_t len) {
 
34
  char * ret_val = malloc (len + 1);
35
35
  strncpy (ret_val, s, len);
 
36
  free (s);
36
37
  return ret_val;
37
38
}
 
39
 
 
40
void s_print (const char * string) {
 
41
  fprintf (stdout, string);
 
42
}