Sfoglia il codice sorgente

Allow for named images.

tags/v0.9.3
Michael Brown 17 anni fa
parent
commit
7bf94b5ad6
1 ha cambiato i file con 5 aggiunte e 3 eliminazioni
  1. 5
    3
      src/core/image.c

+ 5
- 3
src/core/image.c Vedi File

@@ -49,9 +49,11 @@ static struct image_type image_types_end[0]
49 49
 int register_image ( struct image *image ) {
50 50
 	static unsigned int imgindex = 0;
51 51
 
52
-	/* Create image name */
53
-	snprintf ( image->name, sizeof ( image->name ), "img%d",
54
-		   imgindex++ );
52
+	/* Create image name if it doesn't already have one */
53
+	if ( ! image->name[0] ) {
54
+		snprintf ( image->name, sizeof ( image->name ), "img%d",
55
+			   imgindex++ );
56
+	}
55 57
 
56 58
 	/* Add to image list */
57 59
 	list_add_tail ( &image->list, &images );

Loading…
Annulla
Salva