Skip to content

Commit

Permalink
[codingstd] C parentheses, mostly.
Browse files Browse the repository at this point in the history
  • Loading branch information
jkeenan committed Aug 27, 2011
1 parent eb87275 commit 9369d70
Show file tree
Hide file tree
Showing 9 changed files with 75 additions and 27 deletions.
11 changes: 9 additions & 2 deletions src/6model/repr_registry.c
Expand Up @@ -43,9 +43,9 @@ register_repr(PARROT_INTERP, STRING *name, REPROps *repr)
INTVAL ID = num_reprs;
num_reprs++;
if (repr_registry)
repr_registry = mem_sys_realloc(repr_registry, num_reprs * sizeof(REPROps *));
repr_registry = mem_sys_realloc(repr_registry, num_reprs * sizeof (REPROps *));
else
repr_registry = mem_sys_allocate(num_reprs * sizeof(REPROps *));
repr_registry = mem_sys_allocate(num_reprs * sizeof (REPROps *));
repr_registry[ID] = repr;
VTABLE_set_integer_keyed_str(interp, repr_name_to_id_map, name, ID);
}
Expand Down Expand Up @@ -97,3 +97,10 @@ REPR_get_by_name(PARROT_INTERP, STRING *name)
{
return repr_registry[VTABLE_get_integer_keyed_str(interp, repr_name_to_id_map, name)];
}

/*
* Local variables:
* c-file-style: "parrot"
* End:
* vim: expandtab shiftwidth=4 cinoptions='\:2=2' :
*/
14 changes: 10 additions & 4 deletions src/6model/reprs/HashAttrStore.c
Expand Up @@ -197,8 +197,7 @@ instance_of(PARROT_INTERP, PMC *WHAT)
/* Allocate and set up object instance. */
obj = (HashAttrStoreInstance *) Parrot_gc_allocate_fixed_size_storage(
interp,
sizeof(HashAttrStoreInstance)
);
sizeof (HashAttrStoreInstance));
obj->common.stable = STABLE_PMC(WHAT);
obj->store = pmc_new(interp, enum_class_Hash);

Expand Down Expand Up @@ -290,7 +289,7 @@ repr_clone(PARROT_INTERP, PMC *to_clone)
HashAttrStoreInstance *obj;

/* Allocate and set up object instance. */
obj = (HashAttrStoreInstance *) Parrot_gc_allocate_fixed_size_storage(interp, sizeof(HashAttrStoreInstance));
obj = (HashAttrStoreInstance *) Parrot_gc_allocate_fixed_size_storage(interp, sizeof (HashAttrStoreInstance));
obj->common.stable = STABLE_PMC(to_clone);
obj->store = VTABLE_clone(interp, ((HashAttrStoreInstance *)PMC_data(to_clone))->store);

Expand Down Expand Up @@ -370,7 +369,7 @@ gc_mark(PARROT_INTERP, PMC *obj)
static void
gc_free(PARROT_INTERP, PMC *obj)
{
Parrot_gc_free_fixed_size_storage(interp, sizeof(HashAttrStoreInstance), PMC_data(obj));
Parrot_gc_free_fixed_size_storage(interp, sizeof (HashAttrStoreInstance), PMC_data(obj));
PMC_data(obj) = NULL;
}

Expand Down Expand Up @@ -426,3 +425,10 @@ HashAttrStore_initialize(PARROT_INTERP)
this_repr->is_attribute_initialized = is_attribute_initialized;
return this_repr;
}

/*
* Local variables:
* c-file-style: "parrot"
* End:
* vim: expandtab shiftwidth=4 cinoptions='\:2=2' :
*/
9 changes: 8 additions & 1 deletion src/6model/reprs/P6int.c
Expand Up @@ -358,7 +358,7 @@ get_storage_spec(PARROT_INTERP, STable *st)
{
storage_spec spec;
spec.inlineable = STORAGE_SPEC_INLINED;
spec.bits = sizeof(INTVAL) * 8;
spec.bits = sizeof (INTVAL) * 8;
spec.boxed_primitive = STORAGE_SPEC_BP_INT;
return spec;
}
Expand Down Expand Up @@ -403,3 +403,10 @@ P6int_initialize(PARROT_INTERP)
this_repr->is_attribute_initialized = is_attribute_initialized;
return this_repr;
}

/*
* Local variables:
* c-file-style: "parrot"
* End:
* vim: expandtab shiftwidth=4 cinoptions='\:2=2' :
*/
2 changes: 1 addition & 1 deletion src/6model/reprs/P6num.c
Expand Up @@ -358,7 +358,7 @@ get_storage_spec(PARROT_INTERP, STable *st)
{
storage_spec spec;
spec.inlineable = STORAGE_SPEC_INLINED;
spec.bits = sizeof(FLOATVAL) * 8;
spec.bits = sizeof (FLOATVAL) * 8;
spec.boxed_primitive = STORAGE_SPEC_BP_NUM;
return spec;
}
Expand Down
25 changes: 16 additions & 9 deletions src/6model/reprs/P6opaque.c
Expand Up @@ -371,7 +371,7 @@ index_mapping_and_flat_list(PARROT_INTERP, PMC *WHAT, P6opaqueREPRData *repr_dat

/* We can now form the name map. */
num_classes = VTABLE_elements(interp, class_list);
result = (P6opaqueNameMap *) mem_sys_allocate_zeroed(sizeof(P6opaqueNameMap) * (1 + num_classes));
result = (P6opaqueNameMap *) mem_sys_allocate_zeroed(sizeof (P6opaqueNameMap) * (1 + num_classes));
for (i = 0; i < num_classes; i++) {
result[i].class_key = VTABLE_get_pmc_keyed_int(interp, class_list, i);
result[i].name_map = VTABLE_get_pmc_keyed_int(interp, attr_map_list, i);
Expand Down Expand Up @@ -408,14 +408,14 @@ compute_allocation_strategy(PARROT_INTERP, PMC *WHAT, P6opaqueREPRData *repr_dat

/* If we have no attributes in the index mapping, then just the header. */
if (repr_data->name_to_index_mapping[0].class_key == NULL) {
repr_data->allocation_size = sizeof(SixModelObjectCommonalities) + sizeof(PMC *);
repr_data->allocation_size = sizeof (SixModelObjectCommonalities) + sizeof (PMC *);
}

/* Otherwise, we need to compute the allocation strategy. */
else {
/* Initial size is for commonalities (e.g. shared table pointer) and
* spill hash space. */
INTVAL cur_size = sizeof(SixModelObjectCommonalities) + sizeof(PMC *);
INTVAL cur_size = sizeof (SixModelObjectCommonalities) + sizeof (PMC *);

/* Get number of attributes and set up various counters. */
INTVAL num_attrs = VTABLE_elements(interp, flat_list);
Expand All @@ -426,7 +426,7 @@ compute_allocation_strategy(PARROT_INTERP, PMC *WHAT, P6opaqueREPRData *repr_dat

/* Allocate offset array and GC mark info arrays. */
repr_data->num_attributes = num_attrs;
repr_data->attribute_offsets = (INTVAL *) mem_sys_allocate(info_alloc * sizeof(INTVAL));
repr_data->attribute_offsets = (INTVAL *) mem_sys_allocate(info_alloc * sizeof (INTVAL));

/* Go over the attributes and arrange their allocation. */
for (i = 0; i < num_attrs; i++) {
Expand All @@ -439,7 +439,7 @@ compute_allocation_strategy(PARROT_INTERP, PMC *WHAT, P6opaqueREPRData *repr_dat

/* Work out what unboxed type it is, if any. Default to a boxed. */
INTVAL unboxed_type = STORAGE_SPEC_BP_NONE;
INTVAL bits = sizeof(PMC *) * 8;
INTVAL bits = sizeof (PMC *) * 8;
if (!PMC_IS_NULL(type)) {
/* Get the storage spec of the type and see what it wants. */
storage_spec spec = REPR(type)->get_storage_spec(interp, STABLE(type));
Expand Down Expand Up @@ -481,19 +481,19 @@ compute_allocation_strategy(PARROT_INTERP, PMC *WHAT, P6opaqueREPRData *repr_dat
repr_data->attribute_offsets[i] = cur_size;
if (unboxed_type == STORAGE_SPEC_BP_NONE) {
if (!repr_data->gc_pmc_mark_offsets)
repr_data->gc_pmc_mark_offsets = (INTVAL *) mem_sys_allocate_zeroed(info_alloc * sizeof(INTVAL));
repr_data->gc_pmc_mark_offsets = (INTVAL *) mem_sys_allocate_zeroed(info_alloc * sizeof (INTVAL));
repr_data->gc_pmc_mark_offsets[cur_pmc_attr] = cur_size;
cur_pmc_attr++;
if (!PMC_IS_NULL(av_cont)) {
/* Stash away auto-viv container info. */
if (!repr_data->auto_viv_values)
repr_data->auto_viv_values = (PMC **) mem_sys_allocate_zeroed(info_alloc * sizeof(PMC *));
repr_data->auto_viv_values = (PMC **) mem_sys_allocate_zeroed(info_alloc * sizeof (PMC *));
repr_data->auto_viv_values[i] = av_cont;
}
}
if (unboxed_type == STORAGE_SPEC_BP_STR) {
if (!repr_data->gc_str_mark_offsets)
repr_data->gc_str_mark_offsets = (INTVAL *) mem_sys_allocate_zeroed(info_alloc * sizeof(INTVAL));
repr_data->gc_str_mark_offsets = (INTVAL *) mem_sys_allocate_zeroed(info_alloc * sizeof (INTVAL));
repr_data->gc_str_mark_offsets[cur_str_attr] = cur_size;
cur_str_attr++;
}
Expand Down Expand Up @@ -875,7 +875,7 @@ repr_clone(PARROT_INTERP, PMC *to_clone)
}
else {
obj = mem_allocate_zeroed_typed(P6opaqueInstance);
memcpy(obj, PMC_data(to_clone), sizeof(P6opaqueInstance));
memcpy(obj, PMC_data(to_clone), sizeof (P6opaqueInstance));
}

return wrap_object(interp, obj);
Expand Down Expand Up @@ -1223,3 +1223,10 @@ P6opaque_initialize(PARROT_INTERP)
this_repr->change_type = change_type;
return this_repr;
}

/*
* Local variables:
* c-file-style: "parrot"
* End:
* vim: expandtab shiftwidth=4 cinoptions='\:2=2' :
*/
9 changes: 8 additions & 1 deletion src/6model/reprs/P6str.c
Expand Up @@ -367,7 +367,7 @@ get_storage_spec(PARROT_INTERP, STable *st)
{
storage_spec spec;
spec.inlineable = STORAGE_SPEC_INLINED;
spec.bits = sizeof(STRING *) * 8;
spec.bits = sizeof (STRING *) * 8;
spec.boxed_primitive = STORAGE_SPEC_BP_STR;
return spec;
}
Expand Down Expand Up @@ -412,3 +412,10 @@ P6str_initialize(PARROT_INTERP)
this_repr->is_attribute_initialized = is_attribute_initialized;
return this_repr;
}

/*
* Local variables:
* c-file-style: "parrot"
* End:
* vim: expandtab shiftwidth=4 cinoptions='\:2=2' :
*/
6 changes: 3 additions & 3 deletions src/6model/sixmodelobject.c
Expand Up @@ -16,12 +16,12 @@ static PMC * default_find_method(PARROT_INTERP,
INTVAL hint)
__attribute__nonnull__(1);

static INTVAL default_type_check (PARROT_INTERP, PMC *to_check, PMC *wanted)
static INTVAL default_type_check(PARROT_INTERP, PMC *to_check, PMC *wanted)
__attribute__nonnull__(1);

#define ASSERT_ARGS_default_find_method __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(interp))
#define ASSERT_ARGS_default_type_check __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
#define ASSERT_ARGS_default_type_check __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(interp))
/* Don't modify between HEADERIZER BEGIN / HEADERIZER END. Your changes will be lost. */
/* HEADERIZER END: static */
Expand Down Expand Up @@ -110,7 +110,7 @@ default_find_method(PARROT_INTERP, PMC *obj, STRING *name, INTVAL hint)
* be the only one we end up with since the HOW is the authority here.
* So we may end up not calling this through the S-Table in the end. */
static INTVAL
default_type_check (PARROT_INTERP, PMC *to_check, PMC *wanted)
default_type_check(PARROT_INTERP, PMC *to_check, PMC *wanted)
{
PMC *HOW, *meth, *result;

Expand Down
9 changes: 8 additions & 1 deletion src/ops/6model.ops
Expand Up @@ -405,7 +405,7 @@ inline op publish_type_check_cache(in PMC, in PMC) :base_core {
STable *target_st = STABLE(target);
INTVAL items = VTABLE_elements(interp, $2);
if (items > 0) {
PMC ** cache = (PMC **) mem_sys_allocate(sizeof(PMC *) * items);
PMC ** cache = (PMC **) mem_sys_allocate(sizeof (PMC *) * items);
INTVAL i;
for (i = 0; i < items; i++)
cache[i] = decontainerize(interp, VTABLE_get_pmc_keyed_int(interp, $2, i));
Expand Down Expand Up @@ -979,3 +979,10 @@ inline op set_container_spec(in PMC, in PMC, in STR, in PMC) :base_core {
=back

*/

/*
* Local variables:
* c-file-style: "parrot"
* End:
* vim: expandtab shiftwidth=4 cinoptions='\:2=2' :
*/
17 changes: 12 additions & 5 deletions src/pmc/serializationcontext.pmc
Expand Up @@ -66,24 +66,24 @@ pmclass SerializationContext auto_attrs {
INTVAL elems;
GETATTR_SerializationContext_root_objects(interp, SELF, root_objects);
elems = VTABLE_elements(interp, root_objects);
RETURN (INTVAL elems);
RETURN(INTVAL elems);
}

METHOD STRING* handle() {
STRING *handle;
GETATTR_SerializationContext_handle(interp, SELF, handle);
RETURN (STRING* handle);
RETURN(STRING* handle);
}

METHOD set_description(STRING *description) {
SETATTR_SerializationContext_description(interp, SELF, description);
RETURN (STRING* description);
RETURN(STRING* description);
}

METHOD STRING* description() {
STRING *description;
GETATTR_SerializationContext_description(interp, SELF, description);
RETURN (STRING* description);
RETURN(STRING* description);
}

METHOD INTVAL slot_index_for(PMC *obj) {
Expand All @@ -94,10 +94,17 @@ pmclass SerializationContext auto_attrs {
count = VTABLE_elements(interp, root_objects);
for (i = 0; i < count; i++) {
if (VTABLE_get_pmc_keyed_int(interp, root_objects, i) == obj) {
RETURN (INTVAL i);
RETURN(INTVAL i);
}
}
Parrot_ex_throw_from_c_args(interp, NULL, EXCEPTION_INVALID_OPERATION,
"Object does not exist in serialization context");
}
}

/*
* Local variables:
* c-file-style: "parrot"
* End:
* vim: expandtab shiftwidth=4 cinoptions='\:2=2' :
*/

0 comments on commit 9369d70

Please sign in to comment.