non recursive string_replace
Previous to this commit a replacement that also contains the needle would cause an endless loop
This commit is contained in:
		
							parent
							
								
									62ecd76cfe
								
							
						
					
					
						commit
						ae21145121
					
				
							
								
								
									
										4
									
								
								utils.c
									
									
									
									
									
								
							
							
						
						
									
										4
									
								
								utils.c
									
									
									
									
									
								
							| @ -43,11 +43,7 @@ char *string_replace(const char *needle, const char *replacement, | ||||
|         sprintf(tmp + strlen(tmp), "%s%s", replacement, start + strlen(needle)); | ||||
|         free(haystack); | ||||
| 
 | ||||
|         if (strstr(tmp, needle)) { | ||||
|                 return string_replace(needle, replacement, tmp); | ||||
|         } else { | ||||
|         return tmp; | ||||
|         } | ||||
| } | ||||
| 
 | ||||
| int digit_count(int i) | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 Sascha Kruse
						Sascha Kruse