[PATCH libdrm 04/24] radeon: annotate bof_incref, bof_string functions as static
Jerome Glisse
j.glisse at gmail.com
Wed Apr 1 10:31:41 PDT 2015
On Wed, Apr 01, 2015 at 05:15:15PM +0100, Emil Velikov wrote:
> Used locally in bof.c.
>
> Cc: Jerome Glisse <jglisse at redhat.com>
> Signed-off-by: Emil Velikov <emil.l.velikov at gmail.com>
NAK
I use all this in tools to debug lockup. Best course of action is to
exclude bof.h from being distributed. My tools static link and i just
point them to libdrm git tree.
Cheers,
Jérôme
> ---
> radeon/bof.c | 96 ++++++++++++++++++++++++++++++------------------------------
> radeon/bof.h | 3 --
> 2 files changed, 48 insertions(+), 51 deletions(-)
>
> diff --git a/radeon/bof.c b/radeon/bof.c
> index 6f3760a..20901a0 100644
> --- a/radeon/bof.c
> +++ b/radeon/bof.c
> @@ -45,6 +45,54 @@ static int bof_entry_grow(bof_t *bof)
> return 0;
> }
>
> +static void bof_incref(bof_t *bof)
> +{
> + bof->refcount++;
> +}
> +
> +void bof_decref(bof_t *bof)
> +{
> + unsigned i;
> +
> + if (bof == NULL)
> + return;
> + if (--bof->refcount > 0)
> + return;
> + for (i = 0; i < bof->array_size; i++) {
> + bof_decref(bof->array[i]);
> + bof->array[i] = NULL;
> + }
> + bof->array_size = 0;
> + if (bof->file) {
> + fclose(bof->file);
> + bof->file = NULL;
> + }
> + free(bof->array);
> + free(bof->value);
> + free(bof);
> +}
> +
> +/*
> + * string
> + */
> +static bof_t *bof_string(const char *value)
> +{
> + bof_t *string = bof_object();
> +
> + if (string == NULL)
> + return NULL;
> + string->type = BOF_TYPE_STRING;
> + string->size = strlen(value) + 1;
> + string->value = calloc(1, string->size);
> + if (string->value == NULL) {
> + bof_decref(string);
> + return NULL;
> + }
> + strcpy(string->value, value);
> + string->size += 12;
> + return string;
> +}
> +
> /*
> * object
> */
> @@ -160,27 +208,6 @@ void *bof_blob_value(bof_t *bof)
> }
>
> /*
> - * string
> - */
> -bof_t *bof_string(const char *value)
> -{
> - bof_t *string = bof_object();
> -
> - if (string == NULL)
> - return NULL;
> - string->type = BOF_TYPE_STRING;
> - string->size = strlen(value) + 1;
> - string->value = calloc(1, string->size);
> - if (string->value == NULL) {
> - bof_decref(string);
> - return NULL;
> - }
> - strcpy(string->value, value);
> - string->size += 12;
> - return string;
> -}
> -
> -/*
> * int32
> */
> bof_t *bof_int32(int32_t value)
> @@ -316,33 +343,6 @@ out_err:
> return -EINVAL;
> }
>
> -void bof_incref(bof_t *bof)
> -{
> - bof->refcount++;
> -}
> -
> -void bof_decref(bof_t *bof)
> -{
> - unsigned i;
> -
> - if (bof == NULL)
> - return;
> - if (--bof->refcount > 0)
> - return;
> - for (i = 0; i < bof->array_size; i++) {
> - bof_decref(bof->array[i]);
> - bof->array[i] = NULL;
> - }
> - bof->array_size = 0;
> - if (bof->file) {
> - fclose(bof->file);
> - bof->file = NULL;
> - }
> - free(bof->array);
> - free(bof->value);
> - free(bof);
> -}
> -
> static int bof_file_write(bof_t *bof, FILE *file)
> {
> unsigned i;
> diff --git a/radeon/bof.h b/radeon/bof.h
> index 8e952c1..4dae923 100644
> --- a/radeon/bof.h
> +++ b/radeon/bof.h
> @@ -63,14 +63,11 @@ extern unsigned bof_array_size(bof_t *bof);
> extern bof_t *bof_blob(unsigned size, void *value);
> extern unsigned bof_blob_size(bof_t *bof);
> extern void *bof_blob_value(bof_t *bof);
> -/* string */
> -extern bof_t *bof_string(const char *value);
> /* int32 */
> extern bof_t *bof_int32(int32_t value);
> extern int32_t bof_int32_value(bof_t *bof);
> /* common functions */
> extern void bof_decref(bof_t *bof);
> -extern void bof_incref(bof_t *bof);
> extern int bof_dump_file(bof_t *bof, const char *filename);
>
> static inline int bof_is_object(bof_t *bof){return (bof->type == BOF_TYPE_OBJECT);}
> --
> 2.3.1
>
> _______________________________________________
> dri-devel mailing list
> dri-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/dri-devel
More information about the dri-devel
mailing list