comparison src/img_ldr_dummy.c @ 1105:1b3e295f3acb

Add a dummy image loader. It is used with --with-image-loader=dummy of configure. It is a dummy image load that always abort the program when the program try to load or free an image. This module can be used for early stage of a new platform backend.
author Thinker K.F. Li <thinker@codemud.net>
date Sun, 05 Dec 2010 21:04:12 +0800
parents
children
comparison
equal deleted inserted replaced
1104:9d52dda8d49f 1105:1b3e295f3acb
1 #include <stdio.h>
2 #include "mb_img_ldr.h"
3
4 static mb_img_data_t *img_ldr_dummy_load(mb_img_ldr_t *ldr,
5 const char *img_id);
6 static void img_ldr_dummy_free(mb_img_ldr_t *ldr);
7
8 static mb_img_ldr_t img_ldr = {
9 img_ldr_dummy_load,
10 img_ldr_dummy_free
11 };
12
13 #ifndef ERR
14 #include <stdio.h>
15 #include <stdlib.h>
16 #define ERR(msg) do { fprintf(stderr, __FILE__ ":%d: %s", __LINE__, msg); abort(); } while(0)
17 #endif
18 #ifndef NOT_IMPLEMENT
19 #define NOT_IMPLEMENT(func) \
20 ERR(func " is not impmemented\n")
21 #endif
22
23 static mb_img_data_t *
24 img_ldr_dummy_load(mb_img_ldr_t *ldr, const char *img_id) {
25 NOT_IMPLEMENT("img_ldr_dummy_load");
26 return NULL;
27 }
28
29 static void
30 img_ldr_dummy_free(mb_img_ldr_t *ldr) {
31 NOT_IMPLEMENT("img_ldr_dummy_free");
32 }
33
34 mb_img_ldr_t *
35 simple_mb_img_ldr_new(const char *img_repository) {
36 return &img_ldr;
37 }
38