Debug prints now only in debug builds
This commit is contained in:
		
							parent
							
								
									9c843e6af3
								
							
						
					
					
						commit
						87dfa5b2a6
					
				| @ -112,18 +112,19 @@ void compress(const char *input_file) { | ||||
|   imageLoadPPM(input_file, img); | ||||
|   zones = imgToZones(img); | ||||
| 
 | ||||
|   /* print segments for debug ************************************************/ | ||||
|   DEBUG { | ||||
|     printf("Detected %zu zones\n", darraySize(zones)); | ||||
|     for (size_t i = 0; i < darraySize(zones); ++i) { | ||||
|       Zone *zone = darrayGet(zones, i); | ||||
|       printf("\n=== Zone %zu (%d %d %d) ===\n", i, zone->r, zone->g, zone->b); | ||||
|       for (size_t j = 0; j < darraySize(zone->segments); ++j) { | ||||
|         Segment *segm = darrayGet(zone->segments, j); | ||||
|       printf("[%d: %d, %d]\t", segm->y, segm->xg, segm->xd); | ||||
|         printf("[%zu: %d, %d]\t", segm->xg / img->x, segm->xg, segm->xd); | ||||
|       } | ||||
|     } | ||||
|     printf("\n"); | ||||
| 
 | ||||
|   } | ||||
| 
 | ||||
|   deleteImage(img); | ||||
|   printf("test\n"); | ||||
| } | ||||
|  | ||||
| @ -122,7 +122,9 @@ int main(int argc, char **argv) { | ||||
|     fprintf(stderr, "ERROR: no input file."); | ||||
|     help(ARGERROR); | ||||
|   } | ||||
|   DEBUG { | ||||
|     printf("input: %s\noutput: %s\n", argresults.input, argresults.output); | ||||
|   } | ||||
|   if(argresults.compress) { | ||||
|     compress(argresults.input); | ||||
|   } else { | ||||
|  | ||||
| @ -111,7 +111,9 @@ unsigned long read_data(FILE *t_fp, Image *t_img, unsigned char **t_data, | ||||
|   unsigned long size; | ||||
|   /* allocation memoire */ | ||||
|   size = t_img->x * t_img->y * 3; | ||||
|   printf("Size image %lu %lu => %lu\n", t_img->x, t_img->y, size); | ||||
|   DEBUG { | ||||
|     printf("Size image %lu %lu => %lu\n", t_img->x, t_img->y, t_img->x * t_img->y); | ||||
|   } | ||||
|   *t_data = (unsigned char *)malloc((size_t)size * sizeof(unsigned char)); | ||||
|   assert(*t_data); | ||||
|   /* read pixel data from file */ | ||||
|  | ||||
| @ -63,7 +63,9 @@ Image *newImage() { | ||||
|  *  \param[in] self Conteneur d’image à détruire | ||||
|  */ | ||||
| void deleteImage(Image *t_self) { | ||||
|   DEBUG { | ||||
|     printf("deleted all pixels\n"); | ||||
|   } | ||||
|   darrayDelete(t_self->pixels); | ||||
|   free(t_self); | ||||
| } | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user