comparison libpurple/protocols/oscar/util.c @ 17235:1927f4ead3ca

Make all the oscar memory allocations and frees use the glib functions to avoid problems when mixing C runtimes.
author Daniel Atallah <daniel.atallah@gmail.com>
date Tue, 22 May 2007 18:56:09 +0000
parents 32c366eeeb99
children 48d2c9dbfcc2
comparison
equal deleted inserted replaced
17234:12d0ad970a15 17235:1927f4ead3ca
99 next = strchr(last, dl); 99 next = strchr(last, dl);
100 } 100 }
101 next = strchr(last, dl); 101 next = strchr(last, dl);
102 102
103 if (curCount < theindex) { 103 if (curCount < theindex) {
104 toReturn = malloc(sizeof(char)); 104 toReturn = g_malloc(sizeof(char));
105 *toReturn = '\0'; 105 *toReturn = '\0';
106 } else { 106 } else {
107 if (next == NULL) { 107 if (next == NULL) {
108 toReturn = malloc((strlen(last) + 1) * sizeof(char)); 108 toReturn = g_malloc((strlen(last) + 1) * sizeof(char));
109 strcpy(toReturn, last); 109 strcpy(toReturn, last);
110 } else { 110 } else {
111 toReturn = malloc((next - last + 1) * sizeof(char)); 111 toReturn = g_malloc((next - last + 1) * sizeof(char));
112 memcpy(toReturn, last, (next - last)); 112 memcpy(toReturn, last, (next - last));
113 toReturn[next - last] = '\0'; 113 toReturn[next - last] = '\0';
114 } 114 }
115 } 115 }
116 return toReturn; 116 return toReturn;