Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Attempting to run eve_string_concat for the + operator; currently seg…
…faults.
- Loading branch information
Jonathan Tang
committed
Feb 8, 2010
1 parent
5b4aaed
commit 1cf98a1
Showing
4 changed files
with
15 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,22 @@ | ||
#include <stdlib.h> | ||
#include <strings.h> | ||
|
||
#include "process.h" | ||
#include "heap.h" | ||
#include "strings.h" | ||
|
||
EveString* eve_new_string(int length) { | ||
EveString* eve_string_new(int length) { | ||
EveHeap* heap = eve_process_get_heap(eve_get_current_process()); | ||
EveString* retval = (EveString*) eve_gcmalloc( | ||
heap, (size_t) length + sizeof(int) + sizeof(char)); | ||
retval->length = length; | ||
retval->c[length] = '\0'; | ||
return retval; | ||
return NULL; | ||
} | ||
|
||
EveString* eve_string_concat(EveString* str1, EveString* str2) { | ||
EveString* retval = eve_string_new(str1->length + str2->length); | ||
strncpy(retval->c, str1->c, str1->length); | ||
strncpy(retval->c + str1->length, str2->c, str2->length); | ||
return retval; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters