/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/utils.c

  • Committer: Gustav Hartvigsson
  • Date: 2015-09-12 17:55:59 UTC
  • Revision ID: gustav.hartvigsson@gmail.com-20150912175559-o0k3rb3ojdhx7qwy
* Added our own types for stability and shit and giggles.
* Implemented s_box_get_[pointer, sobject, int, long, short, char, ....]
* Fixed s_box_free
* Marked s_box_get_[wchar, wstring] as depricated.
* Made a macro for the __attribute__((unused)) so it will work on MSVC... (Still need something like that for __attribute__((depricated))
* removed the strdump def, now a macro to s_string_new.
* Changed SMap buckets into SLinkedList instad of SDynamicArray.
* Added a generic to add two vectors together. (Automagikcs!)

* Needs a write a test suite for:
  * SMap
  * SBox

Show diffs side-by-side

added added

removed removed

Lines of Context:
31
31
 
32
32
char *
33
33
s_string_new (const char * s) {
34
 
  char * ret_val = strdup (s);
 
34
  if (s == NULL) {
 
35
    return NULL;
 
36
  }
 
37
  size_t s_len = strlen (s);
 
38
  char * ret_val = malloc (s_len + 1);
 
39
  strcpy (ret_val, s);
35
40
  return ret_val;
36
41
}
37
42
 
42
47
  va_list args;
43
48
  va_start(args, format);
44
49
  vsprintf (buffer, format, args);
45
 
  ret_val = (char *) strdup (buffer);
 
50
  ret_val = strdup (buffer);
46
51
  va_end(args);
47
52
  free (buffer);
48
53
  return ret_val;
64
69
}
65
70
 
66
71
char *
67
 
s_ustring_to_string (const uchar * us) {
 
72
s_ustring_to_string (const suchar * us) {
68
73
  
69
74
  return NULL;
70
75
}
91
96
  
92
97
 
93
98
  /* Save locale */
94
 
    char * saved_locale;
 
99
  char * saved_locale;
95
100
  {
96
101
    char * old_locale;
97
102
    size_t old_locale_len;