mirror of
				https://github.com/subsurface/subsurface.git
				synced 2025-02-19 22:16:15 +00:00 
			
		
		
		
	cleanup: remove unnecessary string duplication
I don't understand why the functions must be called on a copy of the string. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
		
							parent
							
								
									15bf145f14
								
							
						
					
					
						commit
						cf95c3bd82
					
				
					 1 changed files with 2 additions and 5 deletions
				
			
		| 
						 | 
				
			
			@ -90,7 +90,6 @@ int enumerate_devices(device_callback_t callback, void *userdata, unsigned int t
 | 
			
		|||
	size_t i;
 | 
			
		||||
	FILE *file;
 | 
			
		||||
	char *line = NULL;
 | 
			
		||||
	char *fname;
 | 
			
		||||
	size_t len;
 | 
			
		||||
	if (transport & DC_TRANSPORT_SERIAL) {
 | 
			
		||||
		const char *dirname = "/dev";
 | 
			
		||||
| 
						 | 
				
			
			@ -155,15 +154,13 @@ int enumerate_devices(device_callback_t callback, void *userdata, unsigned int t
 | 
			
		|||
					end++;
 | 
			
		||||
 | 
			
		||||
				*end = '\0';
 | 
			
		||||
				fname = strdup(start);
 | 
			
		||||
 | 
			
		||||
				callback(fname, userdata);
 | 
			
		||||
				callback(start, userdata);
 | 
			
		||||
 | 
			
		||||
				if (is_default_dive_computer_device(fname))
 | 
			
		||||
				if (is_default_dive_computer_device(start))
 | 
			
		||||
					index = entries;
 | 
			
		||||
				entries++;
 | 
			
		||||
				num_uemis++;
 | 
			
		||||
				free((void *)fname);
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		free(line);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue