Skip to content
This repository
Browse code

Change lorito_file_new to const char* and save the name with a strdup

  • Loading branch information...
commit 2268684700256826caa6c1afa71e7e13d23e025e 1 parent 7fd870d
Jon Gentle authored January 18, 2011
4  internal_pmc.c
@@ -81,13 +81,13 @@ lorito_box_str_new(Lorito_Interp *interp, Lorito_Str *str)
81 81
 }
82 82
 
83 83
 Lorito_File *
84  
-lorito_file_new(Lorito_Interp *interp, char *name)
  84
+lorito_file_new(Lorito_Interp *interp, const char *name)
85 85
 {
86 86
   Lorito_File *result = (Lorito_File *) malloc(sizeof(Lorito_File));
87 87
 
88 88
   result->pmc.size = 0;
89 89
   result->pmc.internal_type = FILE_BLOCK;
90  
-  result->name = name;
  90
+  result->name = strdup(name);
91 91
 
92 92
   result->codeseg_count = 0;
93 93
   result->constseg_count = 0;
2  internal_pmc.h
@@ -30,7 +30,7 @@ Lorito_PMC *
30 30
 lorito_box_str_new(Lorito_Interp *interp, Lorito_Str *str);
31 31
 
32 32
 Lorito_File *
33  
-lorito_file_new(Lorito_Interp *interp, char *name);
  33
+lorito_file_new(Lorito_Interp *interp, const char *name);
34 34
 
35 35
 Lorito_Codeseg *
36 36
 lorito_code_block_new(Lorito_Interp *interp, char *name, int length, Lorito_Opcode *code);

0 notes on commit 2268684

Please sign in to comment.
Something went wrong with that request. Please try again.