|
|
@ -621,7 +621,7 @@ char *yon_char_replace(char *source, char *find, char*replace){
|
|
|
|
char *temp=NULL;
|
|
|
|
char *temp=NULL;
|
|
|
|
if(!strstr(replace,find)){
|
|
|
|
if(!strstr(replace,find)){
|
|
|
|
while ((final=strstr(source,find))){
|
|
|
|
while ((final=strstr(source,find))){
|
|
|
|
temp=malloc(strlen(source)-strlen(final));
|
|
|
|
temp=malloc(strlen(source)-strlen(final)+strlen(replace));
|
|
|
|
memset(temp,0,strlen(source)-strlen(final)+strlen(replace));
|
|
|
|
memset(temp,0,strlen(source)-strlen(final)+strlen(replace));
|
|
|
|
memcpy(temp,source,strlen(source)-strlen(final));
|
|
|
|
memcpy(temp,source,strlen(source)-strlen(final));
|
|
|
|
temp=yon_char_append(temp,replace);
|
|
|
|
temp=yon_char_append(temp,replace);
|
|
|
@ -782,7 +782,7 @@ void yon_char_parsed_copy(config_str *source, config_str *to_copy){
|
|
|
|
* Добавляет строку [string] в конец массива строк [parsed] с длинной [size].
|
|
|
|
* Добавляет строку [string] в конец массива строк [parsed] с длинной [size].
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
config_str yon_char_parsed_append(config_str parsed, int *size, char *string){
|
|
|
|
config_str yon_char_parsed_append(config_str parsed, int *size, char *string){
|
|
|
|
config_str new_parsed=realloc(parsed,(*size+1)*sizeof(char*));
|
|
|
|
config_str new_parsed=realloc(parsed,((*size)+2)*sizeof(char*));
|
|
|
|
new_parsed[(*size)]=yon_char_new(string);
|
|
|
|
new_parsed[(*size)]=yon_char_new(string);
|
|
|
|
(*size)++;
|
|
|
|
(*size)++;
|
|
|
|
return new_parsed;
|
|
|
|
return new_parsed;
|
|
|
@ -953,7 +953,7 @@ config_str yon_file_open(char *file_path, int *size){
|
|
|
|
*size=0;
|
|
|
|
*size=0;
|
|
|
|
FILE *file = fopen(file_path,"r");
|
|
|
|
FILE *file = fopen(file_path,"r");
|
|
|
|
if (file){
|
|
|
|
if (file){
|
|
|
|
char str_loaded[4098];
|
|
|
|
char *str_loaded=malloc(4098);
|
|
|
|
config_str final_string = NULL;
|
|
|
|
config_str final_string = NULL;
|
|
|
|
while (fgets(str_loaded,4098,file)){
|
|
|
|
while (fgets(str_loaded,4098,file)){
|
|
|
|
final_string = final_string ? yon_char_parsed_append(final_string,size,str_loaded) : yon_char_parsed_new(size,str_loaded,NULL);
|
|
|
|
final_string = final_string ? yon_char_parsed_append(final_string,size,str_loaded) : yon_char_parsed_new(size,str_loaded,NULL);
|
|
|
|