Ticket #886: tt_886.patch
File tt_886.patch, 5.8 KB (added by jimmy, 12 years ago) |
---|
-
config/gen/platform/generic/exec.c
54 54 } 55 55 else { 56 56 /* child */ 57 char * cmd = Parrot_str_to_cstring(interp, command);58 int status = execlp("sh", "sh", "-c", cmd, (void *)NULL);57 char * const cmd = Parrot_str_to_cstring(interp, command); 58 int status = execlp("sh", "sh", "-c", cmd, (void *)NULL); 59 59 60 60 /* if we get here, something's horribly wrong, but free anyway... */ 61 mem_sys_free(cmd);61 Parrot_str_free_cstring(cmd); 62 62 63 63 if (status) 64 64 exit(status); … … 96 96 if (child) { 97 97 /* parent */ 98 98 int status; 99 pid_t returnstat; 100 returnstat = waitpid(child, &status, 0); 99 pid_t returnstat = waitpid(child, &status, 0); 101 100 UNUSED(returnstat); 102 101 return status; 103 102 } … … 105 104 /* child. Be horribly profligate with memory, since we're 106 105 about to be something else */ 107 106 int status, i; 108 char **argv;109 107 STRING *s; 110 char *cmd; 108 char *cmd; 109 char **argv = (char **)mem_sys_allocate((len+1)*sizeof (char *)); 111 110 112 argv = (char **)mem_sys_allocate((len+1)*sizeof (char *));113 111 for (i = 0; i < len; ++i) { 114 112 s = VTABLE_get_string_keyed_int(interp, cmdargs, i); 115 113 argv[i] = Parrot_str_to_cstring(interp, s); 116 114 } 117 cmd = argv[0];118 argv[i] = NULL;119 115 120 status = execvp(cmd, argv); 116 cmd = argv[0]; 117 argv[i] = NULL; 118 status = execvp(cmd, argv); 121 119 /* if we get here, something's horribly wrong... */ 122 120 if (status) { 123 121 exit(status); -
src/debug.c
1274 1274 tmp_stdin, readline, 1275 1275 "S->S", prompt, & s); 1276 1276 { 1277 char * aux = Parrot_str_to_cstring(interpdeb, s);1277 char * const aux = Parrot_str_to_cstring(interpdeb, s); 1278 1278 strcpy(c, aux); 1279 1279 Parrot_str_free_cstring(aux); 1280 1280 } -
src/dynext.c
233 233 { 234 234 ASSERT_ARGS(dlopen_string) 235 235 236 char * pathstr = Parrot_str_to_cstring(interp, path);237 void * handle= Parrot_dlopen(pathstr);236 char * const pathstr = Parrot_str_to_cstring(interp, path); 237 void * handle = Parrot_dlopen(pathstr); 238 238 Parrot_str_free_cstring(pathstr); 239 239 return handle; 240 240 } -
src/interp/inter_misc.c
341 341 342 342 else { 343 343 /* Need to strip back to what follows the final / or \. */ 344 STRING * fullname = VTABLE_get_string(interp, exe_name);345 char * fullname_c = Parrot_str_to_cstring(interp, fullname);346 int pos = strlen(fullname_c) - 1;344 STRING * fullname = VTABLE_get_string(interp, exe_name); 345 char * const fullname_c = Parrot_str_to_cstring(interp, fullname); 346 int pos = strlen(fullname_c) - 1; 347 347 348 348 while (pos > 0 349 349 && fullname_c[pos] != '/' … … 354 354 pos++; 355 355 356 356 basename = Parrot_str_new(interp, fullname_c + pos, 0); 357 mem_sys_free(fullname_c);357 Parrot_str_free_cstring(fullname_c); 358 358 359 359 return basename; 360 360 } -
src/io/unix.c
764 764 } 765 765 766 766 # else 767 UNUSED( l);767 UNUSED(filehandle); 768 768 UNUSED(command); 769 769 UNUSED(flags); 770 770 Parrot_ex_throw_from_c_args(interp, NULL, EXCEPTION_UNIMPLEMENTED, -
src/pmc/os.pmc
476 476 */ 477 477 METHOD readdir(STRING *path) { 478 478 #ifndef _MSC_VER 479 char * const cpath = Parrot_str_to_cstring(interp, path); 480 DIR *dir = opendir(cpath); 479 481 struct dirent *dirent; 480 482 PMC *array; 481 char *cpath = Parrot_str_to_cstring(interp, path);482 483 STRING *retval; 483 DIR *dir = opendir(cpath);484 484 485 485 Parrot_str_free_cstring(cpath); 486 486 -
src/pmc/string.pmc
52 52 53 53 VTABLE void mark() { 54 54 STRING *str_val; 55 56 if (!PMC_data(SELF)) 57 return; 58 55 59 GET_ATTR_str_val(INTERP, SELF, str_val); 56 60 Parrot_gc_mark_STRING_alive(INTERP, str_val); 57 61 } … … 202 206 203 207 /* Only allow constant PMCs to embed constant strings */ 204 208 if (PObj_constant_TEST(SELF) && !PObj_constant_TEST(value)) { 205 char * copy = Parrot_str_to_cstring(INTERP, value);206 value = Parrot_str_new_init(INTERP, copy, strlen(copy),209 char * const copy = Parrot_str_to_cstring(INTERP, value); 210 value = Parrot_str_new_init(INTERP, copy, strlen(copy), 207 211 PARROT_DEFAULT_ENCODING, PARROT_DEFAULT_CHARSET, 208 212 PObj_constant_FLAG); 209 213 Parrot_str_free_cstring(copy);