Fork us on GitHub Follow us on Facebook Follow us on Twitter

Changeset a8be91a in mainline


Ignore:
Timestamp:
2012-08-07T04:32:03Z (9 years ago)
Author:
Sean Bartell <wingedtachikoma@…>
Branches:
lfn, master
Children:
c12b2ae
Parents:
0191bd3
Message:

Bithenge: bithenge_scope_copy can be deleted

Location:
uspace/app/bithenge
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • uspace/app/bithenge/transform.c

    r0191bd3 ra8be91a  
    200200        free(self->params);
    201201        free(self);
    202 }
    203 
    204 /** Copy a scope.
    205  * @param[out] out The scope to fill in; must have been initialized with @a
    206  * bithenge_scope_init.
    207  * @param scope The scope to copy.
    208  * @return EOK on success or an error code from errno.h. */
    209 int bithenge_scope_copy(bithenge_scope_t *out, bithenge_scope_t *scope)
    210 {
    211         out->params = malloc(sizeof(*out->params) * scope->num_params);
    212         if (!out->params)
    213                 return ENOMEM;
    214         memcpy(out->params, scope->params, sizeof(*out->params) *
    215             scope->num_params);
    216         out->num_params = scope->num_params;
    217         for (int i = 0; i < out->num_params; i++)
    218                 bithenge_node_inc_ref(out->params[i]);
    219         bithenge_node_dec_ref(out->current_node);
    220         out->current_node = scope->current_node;
    221         if (out->current_node)
    222                 bithenge_node_inc_ref(out->current_node);
    223         return EOK;
    224202}
    225203
  • uspace/app/bithenge/transform.h

    r0191bd3 ra8be91a  
    151151int bithenge_scope_new(bithenge_scope_t **, bithenge_scope_t *);
    152152void bithenge_scope_dec_ref(bithenge_scope_t *);
    153 int bithenge_scope_copy(bithenge_scope_t *, bithenge_scope_t *);
    154153void bithenge_scope_set_current_node(bithenge_scope_t *, bithenge_node_t *);
    155154bithenge_node_t *bithenge_scope_get_current_node(bithenge_scope_t *);
Note: See TracChangeset for help on using the changeset viewer.