When your question is answered use !solved to mark the question as resolved.
Remember to ask specific questions, provide necessary details, and reduce your question to its simplest form. For tips on how to ask a good question run !howto ask.
31 messages · Page 1 of 1 (latest)
When your question is answered use !solved to mark the question as resolved.
Remember to ask specific questions, provide necessary details, and reduce your question to its simplest form. For tips on how to ask a good question run !howto ask.
the arguments str malloc is like this (it's not the same name but i pass base in argument of my rope_insert_at function)
the problem is that with my realloc on "rope->inner_string->str", the new "size" seem to be good, so no problem with that but all the characters of the argument str are changed :
like this
and i can't understand why str characters are changed during the realloc (i'm not even mentionning str in the line)
it seem than passing by a new char seem to work :
but making a copy like this will reduce the speed of my code i think
The root of this could be anything.
How about you compile with -g3 -fsanitize=address,undefined and just run the code and see what it tells you.
If that doesn't help then please share your entire code (as a codeblock, not as an image please).
for the moment i just try to "make" and get segmentation fault
Well, then you could add these two compile options into your makefile
CFLAGS=-g3 -fsanitize=address,undefined?
yeah
i have a lot of things
i don't really understand all but i have a lot of things like this :
undefined reference to __asan_report_load8' undefined reference to __ubsan_handle_divrem_overflow'
i'm on linux but maybe i don't have all things installed, we gave me that project like this, i don't know a lot of c
i give just the function where i have problems?
The function where you have the problems + all the other functions that touched the problematic piece before (I want to be able to see how it was created, assigned a value to, etc)
okay
there s a lot
Inner_string *inner_string_new(char *str, size_t lenstr)
{
Inner_string *inner_string = (Inner_string *)malloc(sizeof(Inner_string));
if (inner_string == NULL)
{
fprintf(stderr, "Erreur d'allocation mémoire pour la structure Inner_string\n");
exit(EXIT_FAILURE);
}
inner_string->str = str;
inner_string->length = lenstr;
return inner_string;
}
i don't have problems until rope_insert_at that break my mind
i'm maybe thinking than the first time i insert it work (except maybe ajust_inner_string_length that don't seem to work that much) and the other time it may make an error
ok so the problem came from the fact than my base variable is modify when i make the realloc even if i don't mention it inside of it
this is working now, it just seem that it s too slow for the moment
@wary coyote
Please don't delete forum posts. They can be helpful to refer to later and other members can learn from them. In the future you can use !solved to close a post and mark a post as solved.
!solved