@@ -205,116 +205,6 @@ int32_t bof_int32_value(bof_t *bof)
return *((uint32_t*)bof->value);
}
-/*
- * common
- */
-static void bof_indent(int level)
-{
- int i;
-
- for (i = 0; i < level; i++)
- fprintf(stderr, " ");
-}
-
-static void bof_print_bof(bof_t *bof, int level, int entry)
-{
- bof_indent(level);
- if (bof == NULL) {
- fprintf(stderr, "--NULL-- for entry %d\n", entry);
- return;
- }
- switch (bof->type) {
- case BOF_TYPE_STRING:
- fprintf(stderr, "%p string [%s %d]\n", bof, (char*)bof->value, bof->size);
- break;
- case BOF_TYPE_INT32:
- fprintf(stderr, "%p int32 [%d %d]\n", bof, *(int*)bof->value, bof->size);
- break;
- case BOF_TYPE_BLOB:
- fprintf(stderr, "%p blob [%d]\n", bof, bof->size);
- break;
- case BOF_TYPE_NULL:
- fprintf(stderr, "%p null [%d]\n", bof, bof->size);
- break;
- case BOF_TYPE_OBJECT:
- fprintf(stderr, "%p object [%d %d]\n", bof, bof->array_size / 2, bof->size);
- break;
- case BOF_TYPE_ARRAY:
- fprintf(stderr, "%p array [%d %d]\n", bof, bof->array_size, bof->size);
- break;
- default:
- fprintf(stderr, "%p unknown [%d]\n", bof, bof->type);
- return;
- }
-}
-
-static void bof_print_rec(bof_t *bof, int level, int entry)
-{
- unsigned i;
-
- bof_print_bof(bof, level, entry);
- for (i = 0; i < bof->array_size; i++) {
- bof_print_rec(bof->array[i], level + 2, i);
- }
-}
-
-static int bof_read(bof_t *root, FILE *file, long end, int level)
-{
- bof_t *bof = NULL;
- int r;
-
- if (ftell(file) >= end) {
- return 0;
- }
- r = bof_entry_grow(root);
- if (r)
- return r;
- bof = bof_object();
- if (bof == NULL)
- return -ENOMEM;
- bof->offset = ftell(file);
- r = fread(&bof->type, 4, 1, file);
- if (r != 1)
- goto out_err;
- r = fread(&bof->size, 4, 1, file);
- if (r != 1)
- goto out_err;
- r = fread(&bof->array_size, 4, 1, file);
- if (r != 1)
- goto out_err;
- switch (bof->type) {
- case BOF_TYPE_STRING:
- case BOF_TYPE_INT32:
- case BOF_TYPE_BLOB:
- bof->value = calloc(1, bof->size - 12);
- if (bof->value == NULL) {
- goto out_err;
- }
- r = fread(bof->value, bof->size - 12, 1, file);
- if (r != 1) {
- fprintf(stderr, "error reading %d\n", bof->size - 12);
- goto out_err;
- }
- break;
- case BOF_TYPE_NULL:
- return 0;
- case BOF_TYPE_OBJECT:
- case BOF_TYPE_ARRAY:
- r = bof_read(bof, file, bof->offset + bof->size, level + 2);
- if (r)
- goto out_err;
- break;
- default:
- fprintf(stderr, "invalid type %d\n", bof->type);
- goto out_err;
- }
- root->array[root->centry++] = bof;
- return bof_read(root, file, end, level);
-out_err:
- bof_decref(bof);
- return -EINVAL;
-}
-
static int bof_file_write(bof_t *bof, FILE *file)
{
unsigned i;
The users of bof_print_rec and bof_read(bof_print and bof_load_file respectively) were removed with earlier commit. With the former two gone, two more functions become unused - bof_print_bof and bof_indent. Remove those as well. Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com> --- radeon/bof.c | 110 ----------------------------------------------------------- 1 file changed, 110 deletions(-)