ソースを参照

Add free_image

tags/v0.9.3
Michael Brown 17年前
コミット
742f242863
2個のファイルの変更18行の追加0行の削除
  1. 17
    0
      src/core/image.c
  2. 1
    0
      src/include/gpxe/image.h

+ 17
- 0
src/core/image.c ファイルの表示

@@ -89,6 +89,23 @@ struct image * find_image ( const char *name ) {
89 89
 	return NULL;
90 90
 }
91 91
 
92
+/**
93
+ * Free loaded image
94
+ *
95
+ * @v image		Executable/loadable image
96
+ *
97
+ * This releases the memory being used to store the image; it does not
98
+ * release the @c struct @c image itself, nor does it unregister the
99
+ * image.
100
+ */
101
+void free_image ( struct image *image ) {
102
+	if ( image->free )
103
+		image->free ( image->data );
104
+	image->free = NULL;
105
+	image->data = UNULL;
106
+	image->len = 0;
107
+}
108
+
92 109
 /**
93 110
  * Load executable/loadable image into memory
94 111
  *

+ 1
- 0
src/include/gpxe/image.h ファイルの表示

@@ -109,6 +109,7 @@ extern struct list_head images;
109 109
 extern int register_image ( struct image *image );
110 110
 extern void unregister_image ( struct image *image );
111 111
 struct image * find_image ( const char *name );
112
+extern void free_image ( struct image *image );
112 113
 extern int image_load ( struct image *image );
113 114
 extern int image_autoload ( struct image *image );
114 115
 extern int image_exec ( struct image *image );

読み込み中…
キャンセル
保存