diff options
author | Tavian Barnes <tavianator@gmail.com> | 2011-04-03 21:30:15 -0400 |
---|---|---|
committer | Tavian Barnes <tavianator@gmail.com> | 2011-04-03 21:30:15 -0400 |
commit | 5a535f9fac3f4b82f0b154b4c81fd1e2a8d62802 (patch) | |
tree | 2b642b87d97ab13b050e1ef9323725c0bbd5b5c6 | |
parent | 7bc2770af08e317b2076540050c68d2de55a11db (diff) | |
download | dimension-5a535f9fac3f4b82f0b154b4c81fd1e2a8d62802.tar.xz |
Don't use awkward (*fptr)() syntax.
47 files changed, 154 insertions, 156 deletions
diff --git a/bench/libdimension/list.c b/bench/libdimension/list.c index 6cd0bc1..ce6c6cc 100644 --- a/bench/libdimension/list.c +++ b/bench/libdimension/list.c @@ -105,7 +105,7 @@ main(void) printf("dmnsn_list_split(): %ld\n", sandglass.grains); /* dmnsn_list_sort() */ - sandglass_bench(&sandglass, dmnsn_list_sort(list, &dmnsn_comparator)); + sandglass_bench(&sandglass, dmnsn_list_sort(list, dmnsn_comparator)); printf("dmnsn_list_sort(): %ld\n", sandglass.grains); /* dmnsn_list_remove() */ diff --git a/bench/libdimension/prtree.c b/bench/libdimension/prtree.c index e568d7d..6e793e4 100644 --- a/bench/libdimension/prtree.c +++ b/bench/libdimension/prtree.c @@ -59,8 +59,8 @@ dmnsn_new_fake_object(void) dmnsn_object *object = dmnsn_new_object(); /* Generate a bounding box in (-1, -1, -1), (1, 1, 1) */ dmnsn_randomize_bounding_box(object); - object->intersection_fn = &dmnsn_fake_intersection_fn; - object->inside_fn = &dmnsn_fake_inside_fn; + object->intersection_fn = dmnsn_fake_intersection_fn; + object->inside_fn = dmnsn_fake_inside_fn; return object; } diff --git a/dimension/parse.c b/dimension/parse.c index 198a4b8..99cda05 100644 --- a/dimension/parse.c +++ b/dimension/parse.c @@ -65,7 +65,7 @@ void dmnsn_pop_scope(dmnsn_symbol_table *symtable) { dmnsn_dictionary *scope; dmnsn_array_pop(symtable, &scope); - dmnsn_dictionary_apply(scope, &dmnsn_delete_symbol_table_entry); + dmnsn_dictionary_apply(scope, dmnsn_delete_symbol_table_entry); dmnsn_delete_dictionary(scope); } @@ -274,7 +274,7 @@ dmnsn_delete_astnode(dmnsn_astnode astnode) if (*astnode.refcount <= 1) { dmnsn_delete_astree(astnode.children); if (astnode.free_fn) { - (*astnode.free_fn)(astnode.ptr); + astnode.free_fn(astnode.ptr); } else { dmnsn_free(astnode.ptr); } diff --git a/dimension/realize.c b/dimension/realize.c index aef8417..019011e 100644 --- a/dimension/realize.c +++ b/dimension/realize.c @@ -1254,7 +1254,7 @@ dmnsn_realize_csg(dmnsn_astnode astnode, dmnsn_astnode modifiers, dmnsn_array_push(lights, &light); } else { dmnsn_object *object = dmnsn_realize_object(*onode, lights); - csg = (*csg_object_fn)(csg, object); + csg = csg_object_fn(csg, object); } } @@ -1268,7 +1268,7 @@ dmnsn_realize_intersection(dmnsn_astnode astnode, dmnsn_astnode modifiers, dmnsn_assert(astnode.type == DMNSN_AST_INTERSECTION, "Expected an intersection."); return dmnsn_realize_csg(astnode, modifiers, lights, - &dmnsn_new_csg_intersection); + dmnsn_new_csg_intersection); } static dmnsn_object * @@ -1277,7 +1277,7 @@ dmnsn_realize_difference(dmnsn_astnode astnode, dmnsn_astnode modifiers, { dmnsn_assert(astnode.type == DMNSN_AST_DIFFERENCE, "Expected a difference."); return dmnsn_realize_csg(astnode, modifiers, lights, - &dmnsn_new_csg_difference); + dmnsn_new_csg_difference); } static dmnsn_object * @@ -1285,7 +1285,7 @@ dmnsn_realize_merge(dmnsn_astnode astnode, dmnsn_astnode modifiers, dmnsn_array *lights) { dmnsn_assert(astnode.type == DMNSN_AST_MERGE, "Expected a merge."); - return dmnsn_realize_csg(astnode, modifiers, lights, &dmnsn_new_csg_merge); + return dmnsn_realize_csg(astnode, modifiers, lights, dmnsn_new_csg_merge); } /* Realize an object, or maybe a light */ diff --git a/dimension/tokenize.c b/dimension/tokenize.c index be6ce84..ced6fe5 100644 --- a/dimension/tokenize.c +++ b/dimension/tokenize.c @@ -752,7 +752,7 @@ dmnsn_declare_macro(int token, dmnsn_token_buffer *prev, prev->auto_delete = true; mnode->ptr = tbuffer; - mnode->free_fn = &dmnsn_delete_token_buffer; + mnode->free_fn = dmnsn_delete_token_buffer; return true; } diff --git a/libdimension/ambient.c b/libdimension/ambient.c index c0333eb..45dca3f 100644 --- a/libdimension/ambient.c +++ b/libdimension/ambient.c @@ -47,8 +47,8 @@ dmnsn_new_ambient_finish(dmnsn_color ambient) *param = ambient; finish->ptr = param; - finish->ambient_fn = &dmnsn_ambient_finish_fn; - finish->free_fn = &dmnsn_free; + finish->ambient_fn = dmnsn_ambient_finish_fn; + finish->free_fn = dmnsn_free; return finish; } diff --git a/libdimension/camera.c b/libdimension/camera.c index 124242c..67117f9 100644 --- a/libdimension/camera.c +++ b/libdimension/camera.c @@ -42,7 +42,7 @@ dmnsn_delete_camera(dmnsn_camera *camera) { if (camera) { if (camera->free_fn) { - (*camera->free_fn)(camera->ptr); + camera->free_fn(camera->ptr); } dmnsn_free(camera); } @@ -52,6 +52,6 @@ dmnsn_delete_camera(dmnsn_camera *camera) dmnsn_line dmnsn_camera_ray(const dmnsn_camera *camera, double x, double y) { - dmnsn_line ray = (*camera->ray_fn)(camera, x, y); + dmnsn_line ray = camera->ray_fn(camera, x, y); return dmnsn_transform_line(camera->trans, ray); } diff --git a/libdimension/canvas.c b/libdimension/canvas.c index 69cc64b..975686d 100644 --- a/libdimension/canvas.c +++ b/libdimension/canvas.c @@ -54,7 +54,7 @@ dmnsn_delete_canvas(dmnsn_canvas *canvas) /* Free the optimizers */ DMNSN_ARRAY_FOREACH (dmnsn_canvas_optimizer *, i, canvas->optimizers) { if (i->free_fn) { - (*i->free_fn)(i->ptr); + i->free_fn(i->ptr); } } dmnsn_delete_array(canvas->optimizers); @@ -85,7 +85,7 @@ dmnsn_set_pixel(dmnsn_canvas *canvas, size_t x, size_t y, /* Call the optimizers */ DMNSN_ARRAY_FOREACH (dmnsn_canvas_optimizer *, i, canvas->optimizers) { - (*i->optimizer_fn)(canvas, *i, x, y); + i->optimizer_fn(canvas, *i, x, y); } } diff --git a/libdimension/canvas_pigment.c b/libdimension/canvas_pigment.c index f3fcba4..002cea3 100644 --- a/libdimension/canvas_pigment.c +++ b/libdimension/canvas_pigment.c @@ -51,8 +51,8 @@ dmnsn_pigment * dmnsn_new_canvas_pigment(dmnsn_canvas *canvas) { dmnsn_pigment *pigment = dmnsn_new_pigment(); - pigment->pigment_fn = &dmnsn_canvas_pigment_fn; - pigment->free_fn = &dmnsn_canvas_pigment_free_fn; + pigment->pigment_fn = dmnsn_canvas_pigment_fn; + pigment->free_fn = dmnsn_canvas_pigment_free_fn; pigment->ptr = canvas; return pigment; } diff --git a/libdimension/checker.c b/libdimension/checker.c index 9ea3959..84b13bd 100644 --- a/libdimension/checker.c +++ b/libdimension/checker.c @@ -55,6 +55,6 @@ dmnsn_pattern * dmnsn_new_checker_pattern(void) { dmnsn_pattern *checker = dmnsn_new_pattern(); - checker->pattern_fn = &dmnsn_checker_pattern_fn; + checker->pattern_fn = dmnsn_checker_pattern_fn; return checker; } diff --git a/libdimension/color_map.c b/libdimension/color_map.c index c047f2b..6390fe5 100644 --- a/libdimension/color_map.c +++ b/libdimension/color_map.c @@ -79,9 +79,9 @@ dmnsn_new_color_map_pigment(dmnsn_pattern *pattern, dmnsn_map *map) payload->pattern = pattern; payload->map = map; - pigment->pigment_fn = &dmnsn_color_map_pigment_fn; - pigment->initialize_fn = &dmnsn_color_map_initialize_fn; - pigment->free_fn = &dmnsn_delete_color_map_payload; + pigment->pigment_fn = dmnsn_color_map_pigment_fn; + pigment->initialize_fn = dmnsn_color_map_initialize_fn; + pigment->free_fn = dmnsn_delete_color_map_payload; pigment->ptr = payload; return pigment; } diff --git a/libdimension/cone.c b/libdimension/cone.c index a6fcfc5..40e8f12 100644 --- a/libdimension/cone.c +++ b/libdimension/cone.c @@ -142,8 +142,8 @@ dmnsn_object * dmnsn_new_cone(double r1, double r2, bool open) { dmnsn_object *cone = dmnsn_new_object(); - cone->intersection_fn = &dmnsn_cone_intersection_fn; - cone->inside_fn = &dmnsn_cone_inside_fn; + cone->intersection_fn = dmnsn_cone_intersection_fn; + cone->inside_fn = dmnsn_cone_inside_fn; double rmax = dmnsn_max(r1, r2); cone->bounding_box.min = dmnsn_new_vector(-rmax, -1.0, -rmax); cone->bounding_box.max = dmnsn_new_vector(rmax, 1.0, rmax); @@ -153,6 +153,6 @@ dmnsn_new_cone(double r1, double r2, bool open) payload->r2 = r2; payload->open = open; cone->ptr = payload; - cone->free_fn = &dmnsn_free; + cone->free_fn = dmnsn_free; return cone; } diff --git a/libdimension/csg.c b/libdimension/csg.c index 34fcfb2..9d02174 100644 --- a/libdimension/csg.c +++ b/libdimension/csg.c @@ -97,10 +97,10 @@ dmnsn_new_csg_union(const dmnsn_array *objects) dmnsn_array_push(csg->children, object); } - csg->intersection_fn = &dmnsn_csg_union_intersection_fn; - csg->inside_fn = &dmnsn_csg_union_inside_fn; - csg->initialize_fn = &dmnsn_csg_union_initialize_fn; - csg->free_fn = &dmnsn_csg_union_free_fn; + csg->intersection_fn = dmnsn_csg_union_intersection_fn; + csg->inside_fn = dmnsn_csg_union_inside_fn; + csg->initialize_fn = dmnsn_csg_union_initialize_fn; + csg->free_fn = dmnsn_csg_union_free_fn; return csg; } @@ -241,10 +241,10 @@ dmnsn_new_csg_intersection(dmnsn_object *A, dmnsn_object *B) params[1] = B; csg->ptr = params; - csg->intersection_fn = &dmnsn_csg_intersection_intersection_fn; - csg->inside_fn = &dmnsn_csg_intersection_inside_fn; - csg->initialize_fn = &dmnsn_csg_intersection_initialize_fn; - csg->free_fn = &dmnsn_csg_free_fn; + csg->intersection_fn = dmnsn_csg_intersection_intersection_fn; + csg->inside_fn = dmnsn_csg_intersection_inside_fn; + csg->initialize_fn = dmnsn_csg_intersection_initialize_fn; + csg->free_fn = dmnsn_csg_free_fn; return csg; } @@ -299,10 +299,10 @@ dmnsn_new_csg_difference(dmnsn_object *A, dmnsn_object *B) params[1] = B; csg->ptr = params; - csg->intersection_fn = &dmnsn_csg_difference_intersection_fn; - csg->inside_fn = &dmnsn_csg_difference_inside_fn; - csg->initialize_fn = &dmnsn_csg_difference_initialize_fn; - csg->free_fn = &dmnsn_csg_free_fn; + csg->intersection_fn = dmnsn_csg_difference_intersection_fn; + csg->inside_fn = dmnsn_csg_difference_inside_fn; + csg->initialize_fn = dmnsn_csg_difference_initialize_fn; + csg->free_fn = dmnsn_csg_free_fn; return csg; } @@ -360,10 +360,10 @@ dmnsn_new_csg_merge(dmnsn_object *A, dmnsn_object *B) params[1] = B; csg->ptr = params; - csg->intersection_fn = &dmnsn_csg_merge_intersection_fn; - csg->inside_fn = &dmnsn_csg_merge_inside_fn; - csg->initialize_fn = &dmnsn_csg_merge_initialize_fn; - csg->free_fn = &dmnsn_csg_free_fn; + csg->intersection_fn = dmnsn_csg_merge_intersection_fn; + csg->inside_fn = dmnsn_csg_merge_inside_fn; + csg->initialize_fn = dmnsn_csg_merge_initialize_fn; + csg->free_fn = dmnsn_csg_free_fn; return csg; } diff --git a/libdimension/cube.c b/libdimension/cube.c index 241f342..98e7345 100644 --- a/libdimension/cube.c +++ b/libdimension/cube.c @@ -137,8 +137,8 @@ dmnsn_object * dmnsn_new_cube(void) { dmnsn_object *cube = dmnsn_new_object(); - cube->intersection_fn = &dmnsn_cube_intersection_fn; - cube->inside_fn = &dmnsn_cube_inside_fn; + cube->intersection_fn = dmnsn_cube_intersection_fn; + cube->inside_fn = dmnsn_cube_inside_fn; cube->bounding_box.min = dmnsn_new_vector(-1.0, -1.0, -1.0); cube->bounding_box.max = dmnsn_new_vector(1.0, 1.0, 1.0); return cube; diff --git a/libdimension/dictionary.c b/libdimension/dictionary.c index 9bae74e..83efe1d 100644 --- a/libdimension/dictionary.c +++ b/libdimension/dictionary.c @@ -225,7 +225,7 @@ void dmnsn_dictionary_apply(dmnsn_dictionary *dict, dmnsn_callback_fn *callback) { if (dict->value) { - (*callback)(dict->value); + callback(dict->value); } DMNSN_ARRAY_FOREACH (dmnsn_dictionary **, subtrie, dict->children) { diff --git a/libdimension/diffuse.c b/libdimension/diffuse.c index d7839d2..fae8e74 100644 --- a/libdimension/diffuse.c +++ b/libdimension/diffuse.c @@ -51,8 +51,8 @@ dmnsn_new_diffuse_finish(double diffuse) *param = diffuse; finish->ptr = param; - finish->diffuse_fn = &dmnsn_diffuse_finish_fn; - finish->free_fn = &dmnsn_free; + finish->diffuse_fn = dmnsn_diffuse_finish_fn; + finish->free_fn = dmnsn_free; return finish; } diff --git a/libdimension/dimension/array.h b/libdimension/dimension/array.h index 159cd36..51830e7 100644 --- a/libdimension/dimension/array.h +++ b/libdimension/dimension/array.h @@ -236,7 +236,7 @@ dmnsn_array_apply(dmnsn_array *array, dmnsn_callback_fn *callback) { char *i, *last = (char *)dmnsn_array_last(array); for (i = (char *)dmnsn_array_first(array); i <= last; i += array->obj_size) { - (*callback)((void *)i); + callback((void *)i); } } diff --git a/libdimension/dimension/object.h b/libdimension/dimension/object.h index 4d7b5f8..46ff8f7 100644 --- a/libdimension/dimension/object.h +++ b/libdimension/dimension/object.h @@ -144,7 +144,7 @@ dmnsn_object_intersection(const dmnsn_object *object, dmnsn_line line, dmnsn_intersection *intersection) { dmnsn_line line_trans = dmnsn_transform_line(object->trans_inv, line); - if ((*object->intersection_fn)(object, line_trans, intersection)) { + if (object->intersection_fn(object, line_trans, intersection)) { /* Get us back into world coordinates */ intersection->ray = line; intersection->normal = dmnsn_transform_normal(object->trans, @@ -165,7 +165,7 @@ DMNSN_INLINE bool dmnsn_object_inside(const dmnsn_object *object, dmnsn_vector point) { point = dmnsn_transform_vector(object->trans_inv, point); - return (*object->inside_fn)(object, point); + return object->inside_fn(object, point); } #endif /* DIMENSION_OBJECT_H */ diff --git a/libdimension/error.c b/libdimension/error.c index 098348b..8fcf1fd 100644 --- a/libdimension/error.c +++ b/libdimension/error.c @@ -32,7 +32,7 @@ static void dmnsn_default_fatal_error_fn(void); /** The current fatal error handler. */ -static dmnsn_fatal_error_fn *dmnsn_fatal = &dmnsn_default_fatal_error_fn; +static dmnsn_fatal_error_fn *dmnsn_fatal = dmnsn_default_fatal_error_fn; /** Mutex which protects \c dmnsn_fatal. */ static pthread_mutex_t dmnsn_fatal_mutex = PTHREAD_MUTEX_INITIALIZER; @@ -66,7 +66,7 @@ dmnsn_report_error(bool die, const char *func, const char *file, if (die || always_die) { /* An error happened, bail out */ dmnsn_fatal_error_fn *fatal = dmnsn_get_fatal_error_fn(); - (*fatal)(); + fatal(); exit(EXIT_FAILURE); /* Failsafe in case *dmnsn_fatal doesn't exit */ } } diff --git a/libdimension/finish.c b/libdimension/finish.c index 80dc228..e647152 100644 --- a/libdimension/finish.c +++ b/libdimension/finish.c @@ -44,7 +44,7 @@ dmnsn_delete_finish(dmnsn_finish *finish) { if (finish) { if (finish->free_fn) { - (*finish->free_fn)(finish->ptr); + finish->free_fn(finish->ptr); } dmnsn_free(finish); } diff --git a/libdimension/finish_combination.c b/libdimension/finish_combination.c index d7525b2..acdc719 100644 --- a/libdimension/finish_combination.c +++ b/libdimension/finish_combination.c @@ -36,13 +36,13 @@ dmnsn_finish_combination_diffuse_fn(const dmnsn_finish *finish, dmnsn_finish **params = finish->ptr; if (params[0]->diffuse_fn && params[1]->diffuse_fn) { return dmnsn_color_add( - (*params[0]->diffuse_fn)(params[0], light, color, ray, normal), - (*params[1]->diffuse_fn)(params[1], light, color, ray, normal) + params[0]->diffuse_fn(params[0], light, color, ray, normal), + params[1]->diffuse_fn(params[1], light, color, ray, normal) ); } else if (params[0]->diffuse_fn) { - return (*params[0]->diffuse_fn)(params[0], light, color, ray, normal); + return params[0]->diffuse_fn(params[0], light, color, ray, normal); } else if (params[1]->diffuse_fn) { - return (*params[1]->diffuse_fn)(params[1], light, color, ray, normal); + return params[1]->diffuse_fn(params[1], light, color, ray, normal); } else { return dmnsn_black; } @@ -58,15 +58,15 @@ dmnsn_finish_combination_specular_fn(const dmnsn_finish *finish, dmnsn_finish **params = finish->ptr; if (params[0]->specular_fn && params[1]->specular_fn) { return dmnsn_color_add( - (*params[0]->specular_fn)(params[0], light, color, ray, normal, viewer), - (*params[1]->specular_fn)(params[1], light, color, ray, normal, viewer) + params[0]->specular_fn(params[0], light, color, ray, normal, viewer), + params[1]->specular_fn(params[1], light, color, ray, normal, viewer) ); } else if (params[0]->specular_fn) { - return (*params[0]->specular_fn)(params[0], light, color, ray, - normal, viewer); + return params[0]->specular_fn(params[0], light, color, ray, + normal, viewer); } else if (params[1]->specular_fn) { - return (*params[1]->specular_fn)(params[1], light, color, ray, - normal, viewer); + return params[1]->specular_fn(params[1], light, color, ray, + normal, viewer); } else { return dmnsn_black; } @@ -79,12 +79,12 @@ dmnsn_finish_combination_ambient_fn(const dmnsn_finish *finish, { dmnsn_finish **params = finish->ptr; if (params[0]->ambient_fn && params[1]->ambient_fn) { - return dmnsn_color_add((*params[0]->ambient_fn)(params[0], pigment), - (*params[1]->ambient_fn)(params[1], pigment)); + return dmnsn_color_add(params[0]->ambient_fn(params[0], pigment), + params[1]->ambient_fn(params[1], pigment)); } else if (params[0]->ambient_fn) { - return (*params[0]->ambient_fn)(params[0], pigment); + return params[0]->ambient_fn(params[0], pigment); } else if (params[1]->ambient_fn) { - return (*params[1]->ambient_fn)(params[1], pigment); + return params[1]->ambient_fn(params[1], pigment); } else { return dmnsn_black; } @@ -99,13 +99,13 @@ dmnsn_finish_combination_reflection_fn(const dmnsn_finish *finish, dmnsn_finish **params = finish->ptr; if (params[0]->reflection_fn && params[1]->reflection_fn) { return dmnsn_color_add( - (*params[0]->reflection_fn)(params[0], reflect, color, ray, normal), - (*params[1]->reflection_fn)(params[1], reflect, color, ray, normal) + params[0]->reflection_fn(params[0], reflect, color, ray, normal), + params[1]->reflection_fn(params[1], reflect, color, ray, normal) ); } else if (params[0]->reflection_fn) { - return (*params[0]->reflection_fn)(params[0], reflect, color, ray, normal); + return params[0]->reflection_fn(params[0], reflect, color, ray, normal); } else if (params[1]->reflection_fn) { - return (*params[1]->reflection_fn)(params[1], reflect, color, ray, normal); + return params[1]->reflection_fn(params[1], reflect, color, ray, normal); } else { return dmnsn_black; } @@ -133,18 +133,18 @@ dmnsn_new_finish_combination(dmnsn_finish *f1, dmnsn_finish *f2) finish->ptr = params; if (f1->diffuse_fn || f2->diffuse_fn) - finish->diffuse_fn = &dmnsn_finish_combination_diffuse_fn; + finish->diffuse_fn = dmnsn_finish_combination_diffuse_fn; if (f1->specular_fn || f2->specular_fn) - finish->specular_fn = &dmnsn_finish_combination_specular_fn; + finish->specular_fn = dmnsn_finish_combination_specular_fn; if (f1->ambient_fn || f2->ambient_fn) - finish->ambient_fn = &dmnsn_finish_combination_ambient_fn; + finish->ambient_fn = dmnsn_finish_combination_ambient_fn; if (f1->reflection_fn || f2->reflection_fn) - finish->reflection_fn = &dmnsn_finish_combination_reflection_fn; + finish->reflection_fn = dmnsn_finish_combination_reflection_fn; - finish->free_fn = &dmnsn_finish_combination_free_fn; + finish->free_fn = dmnsn_finish_combination_free_fn; return finish; } diff --git a/libdimension/gl.c b/libdimension/gl.c index de408a3..77eefcd 100644 --- a/libdimension/gl.c +++ b/libdimension/gl.c @@ -39,14 +39,14 @@ dmnsn_gl_optimize_canvas(dmnsn_canvas *canvas) { /* Check if we've already optimized this canvas */ DMNSN_ARRAY_FOREACH (dmnsn_canvas_optimizer *, i, canvas->optimizers) { - if (i->optimizer_fn == &dmnsn_gl_optimizer_fn) { + if (i->optimizer_fn == dmnsn_gl_optimizer_fn) { return 0; } } dmnsn_canvas_optimizer optimizer; - optimizer.optimizer_fn = &dmnsn_gl_optimizer_fn; - optimizer.free_fn = &dmnsn_free; + optimizer.optimizer_fn = dmnsn_gl_optimizer_fn; + optimizer.free_fn = dmnsn_free; /* Allocate a buffer to hold RGB values */ optimizer.ptr = dmnsn_malloc(4*canvas->width*canvas->height*sizeof(GLushort)); @@ -70,7 +70,7 @@ dmnsn_gl_write_canvas(const dmnsn_canvas *canvas) /* Check if we can optimize this */ DMNSN_ARRAY_FOREACH (dmnsn_canvas_optimizer *, i, canvas->optimizers) { - if (i->optimizer_fn == &dmnsn_gl_optimizer_fn) { + if (i->optimizer_fn == dmnsn_gl_optimizer_fn) { glDrawPixels(width, height, GL_RGBA, GL_UNSIGNED_SHORT, i->ptr); return glGetError() == GL_NO_ERROR ? 0 : 1; } diff --git a/libdimension/gradient.c b/libdimension/gradient.c index b6ee935..ed20b63 100644 --- a/libdimension/gradient.c +++ b/libdimension/gradient.c @@ -44,8 +44,8 @@ dmnsn_new_gradient_pattern(dmnsn_vector orientation) dmnsn_vector *payload = dmnsn_malloc(sizeof(dmnsn_vector)); *payload = dmnsn_vector_normalize(orientation); - gradient->pattern_fn = &dmnsn_gradient_pattern_fn; - gradient->free_fn = &dmnsn_free; + gradient->pattern_fn = dmnsn_gradient_pattern_fn; + gradient->free_fn = dmnsn_free; gradient->ptr = payload; return gradient; diff --git a/libdimension/interior.c b/libdimension/interior.c index c40ee96..939bd4f 100644 --- a/libdimension/interior.c +++ b/libdimension/interior.c @@ -45,7 +45,7 @@ dmnsn_delete_interior(dmnsn_interior *interior) if (interior) { if (*interior->refcount <= 1) { if (interior->free_fn) { - (*interior->free_fn)(interior->ptr); + interior->free_fn(interior->ptr); } dmnsn_free(interior->refcount); dmnsn_free(interior); diff --git a/libdimension/light.c b/libdimension/light.c index cfaa5e1..e1a060c 100644 --- a/libdimension/light.c +++ b/libdimension/light.c @@ -43,7 +43,7 @@ dmnsn_delete_light(dmnsn_light *light) { if (light) { if (light->free_fn) { - (*light->free_fn)(light->ptr); + light->free_fn(light->ptr); } dmnsn_free(light); } diff --git a/libdimension/list.c b/libdimension/list.c index 8fbbdd7..0574744 100644 --- a/libdimension/list.c +++ b/libdimension/list.c @@ -110,7 +110,7 @@ dmnsn_list_sort(dmnsn_list *list, dmnsn_list_comparator_fn *comparator) do { dmnsn_list_iterator *prev = i ? dmnsn_list_prev(i) : dmnsn_list_last(list); - if (!(*comparator)(current, prev)) + if (!comparator(current, prev)) break; i = prev; } while (i != dmnsn_list_first(list)); @@ -138,7 +138,7 @@ dmnsn_list_sort(dmnsn_list *list, dmnsn_list_comparator_fn *comparator) break; } else if (!j) { break; - } else if ((*comparator)(j, i)) { + } else if (comparator(j, i)) { dmnsn_list_iterator *temp = dmnsn_list_next(j); dmnsn_list_iterator_remove(&half, j); dmnsn_list_iterator_insert(list, i, j); diff --git a/libdimension/map.c b/libdimension/map.c index fe2978a..2151525 100644 --- a/libdimension/map.c +++ b/libdimension/map.c @@ -48,7 +48,7 @@ dmnsn_delete_map(dmnsn_map *map) if (map->free_fn) { for (size_t i = 0; i < dmnsn_array_size(map->array); ++i) { dmnsn_map_entry *entry = dmnsn_array_at(map->array, i); - (*map->free_fn)(entry->object); + map->free_fn(entry->object); } } @@ -131,6 +131,6 @@ dmnsn_map_apply(dmnsn_map *map, dmnsn_callback_fn *callback) { for (size_t i = 0; i < dmnsn_array_size(map->array); ++i) { dmnsn_map_entry *entry = dmnsn_array_at(map->array, i); - (*callback)(entry->object); + callback(entry->object); } } diff --git a/libdimension/object.c b/libdimension/object.c index 3896037..dda80f0 100644 --- a/libdimension/object.c +++ b/libdimension/object.c @@ -54,7 +54,7 @@ dmnsn_delete_object(dmnsn_object *object) dmnsn_delete_interior(object->interior); dmnsn_delete_texture(object->texture); if (object->free_fn) { - (*object->free_fn)(object->ptr); + object->free_fn(object->ptr); } dmnsn_free(object); } @@ -73,7 +73,7 @@ dmnsn_initialize_object(dmnsn_object *object) } if (object->initialize_fn) { - (*object->initialize_fn)(object); + object->initialize_fn(object); } object->bounding_box diff --git a/libdimension/pattern.c b/libdimension/pattern.c index 5751397..b266527 100644 --- a/libdimension/pattern.c +++ b/libdimension/pattern.c @@ -40,7 +40,7 @@ void dmnsn_delete_pattern(dmnsn_pattern *pattern) { if (pattern->free_fn) { - (*pattern->free_fn)(pattern->ptr); + pattern->free_fn(pattern->ptr); } dmnsn_free(pattern); } @@ -57,5 +57,5 @@ double dmnsn_pattern_value(const dmnsn_pattern *pattern, dmnsn_vector v) { v = dmnsn_transform_vector(pattern->trans_inv, v); - return (*pattern->pattern_fn)(pattern, v); + return pattern->pattern_fn(pattern, v); } diff --git a/libdimension/perspective.c b/libdimension/perspective.c index 737371d..6b1aadb 100644 --- a/libdimension/perspective.c +++ b/libdimension/perspective.c @@ -42,6 +42,6 @@ dmnsn_camera * dmnsn_new_perspective_camera(void) { dmnsn_camera *camera = dmnsn_new_camera(); - camera->ray_fn = &dmnsn_perspective_camera_ray_fn; + camera->ray_fn = dmnsn_perspective_camera_ray_fn; return camera; } diff --git a/libdimension/phong.c b/libdimension/phong.c index 09dd599..3fc154f 100644 --- a/libdimension/phong.c +++ b/libdimension/phong.c @@ -61,8 +61,8 @@ dmnsn_new_phong_finish(double specular, double exp) params[1] = exp; finish->ptr = params; - finish->specular_fn = &dmnsn_phong_specular_fn; - finish->free_fn = &dmnsn_free; + finish->specular_fn = dmnsn_phong_specular_fn; + finish->free_fn = dmnsn_free; return finish; } diff --git a/libdimension/pigment.c b/libdimension/pigment.c index ed0e10f..a1b4fb7 100644 --- a/libdimension/pigment.c +++ b/libdimension/pigment.c @@ -44,7 +44,7 @@ dmnsn_delete_pigment(dmnsn_pigment *pigment) { if (pigment) { if (pigment->free_fn) { - (*pigment->free_fn)(pigment->ptr); + pigment->free_fn(pigment->ptr); } dmnsn_free(pigment); } @@ -55,7 +55,7 @@ void dmnsn_initialize_pigment(dmnsn_pigment *pigment) { if (pigment->initialize_fn) { - (*pigment->initialize_fn)(pigment); + pigment->initialize_fn(pigment); } pigment->trans_inv = dmnsn_matrix_inverse(pigment->trans); diff --git a/libdimension/pigment_map.c b/libdimension/pigment_map.c index f3d3ba1..9864152 100644 --- a/libdimension/pigment_map.c +++ b/libdimension/pigment_map.c @@ -45,7 +45,7 @@ dmnsn_map * dmnsn_new_pigment_map(void) { dmnsn_map *pigment_map = dmnsn_new_map(sizeof(dmnsn_pigment *)); - pigment_map->free_fn = &dmnsn_delete_mapped_pigment; + pigment_map->free_fn = dmnsn_delete_mapped_pigment; return pigment_map; } @@ -74,8 +74,8 @@ dmnsn_pigment_map_pigment_fn(const dmnsn_pigment *pigment, dmnsn_vector v) dmnsn_pigment *pigment1, *pigment2; dmnsn_evaluate_map(payload->map, dmnsn_pattern_value(payload->pattern, v), &n, &pigment1, &pigment2); - dmnsn_color color1 = (*pigment1->pigment_fn)(pigment1, v); - dmnsn_color color2 = (*pigment2->pigment_fn)(pigment2, v); + dmnsn_color color1 = pigment1->pigment_fn(pigment1, v); + dmnsn_color color2 = pigment2->pigment_fn(pigment2, v); return dmnsn_color_gradient(color1, color2, n); } @@ -87,7 +87,7 @@ dmnsn_pigment_map_initialize_fn(dmnsn_pigment *pigment) payload->pattern->trans = dmnsn_matrix_mul(pigment->trans, payload->pattern->trans); dmnsn_initialize_pattern(payload->pattern); - dmnsn_map_apply(payload->map, &dmnsn_initialize_mapped_pigment); + dmnsn_map_apply(payload->map, dmnsn_initialize_mapped_pigment); } dmnsn_pigment * @@ -100,9 +100,9 @@ dmnsn_new_pigment_map_pigment(dmnsn_pattern *pattern, dmnsn_map *map) payload->pattern = pattern; payload->map = map; - pigment->pigment_fn = &dmnsn_pigment_map_pigment_fn; - pigment->initialize_fn = &dmnsn_pigment_map_initialize_fn; - pigment->free_fn = &dmnsn_delete_pigment_map_payload; + pigment->pigment_fn = dmnsn_pigment_map_pigment_fn; + pigment->initialize_fn = dmnsn_pigment_map_initialize_fn; + pigment->free_fn = dmnsn_delete_pigment_map_payload; pigment->ptr = payload; return pigment; } diff --git a/libdimension/plane.c b/libdimension/plane.c index e58ccc5..8931cc7 100644 --- a/libdimension/plane.c +++ b/libdimension/plane.c @@ -44,9 +44,9 @@ dmnsn_new_plane(dmnsn_vector normal) dmnsn_vector *param = dmnsn_malloc(sizeof(dmnsn_vector)); *param = normal; - plane->intersection_fn = &dmnsn_plane_intersection_fn; - plane->inside_fn = &dmnsn_plane_inside_fn; - plane->free_fn = &dmnsn_free; + plane->intersection_fn = dmnsn_plane_intersection_fn; + plane->inside_fn = dmnsn_plane_inside_fn; + plane->free_fn = dmnsn_free; plane->bounding_box = dmnsn_infinite_bounding_box(); plane->ptr = param; return plane; diff --git a/libdimension/png.c b/libdimension/png.c index 54d3252..9ff2afc 100644 --- a/libdimension/png.c +++ b/libdimension/png.c @@ -41,14 +41,14 @@ dmnsn_png_optimize_canvas(dmnsn_canvas *canvas) { /* Check if we've already optimized this canvas */ DMNSN_ARRAY_FOREACH (dmnsn_canvas_optimizer *, i, canvas->optimizers) { - if (i->optimizer_fn == &dmnsn_png_optimizer_fn) { + if (i->optimizer_fn == dmnsn_png_optimizer_fn) { return 0; } } dmnsn_canvas_optimizer optimizer; - optimizer.optimizer_fn = &dmnsn_png_optimizer_fn; - optimizer.free_fn = &dmnsn_free; + optimizer.optimizer_fn = dmnsn_png_optimizer_fn; + optimizer.free_fn = dmnsn_free; optimizer.ptr = dmnsn_malloc(4*canvas->width*canvas->height*sizeof(uint16_t)); @@ -145,7 +145,7 @@ dmnsn_png_write_canvas_async(const dmnsn_canvas *canvas, FILE *file) payload->file = file; /* Create the worker thread */ - dmnsn_new_thread(progress, &dmnsn_png_write_canvas_thread, payload); + dmnsn_new_thread(progress, dmnsn_png_write_canvas_thread, payload); return progress; } @@ -173,7 +173,7 @@ dmnsn_png_read_canvas_async(dmnsn_canvas **canvas, FILE *file) payload->file = file; /* Create the worker thread */ - dmnsn_new_thread(progress, &dmnsn_png_read_canvas_thread, payload); + dmnsn_new_thread(progress, dmnsn_png_read_canvas_thread, payload); return progress; } @@ -250,7 +250,7 @@ dmnsn_png_write_canvas_thread(void *ptr) DMNSN_ARRAY_FOREACH (dmnsn_canvas_optimizer *, i, payload->canvas->optimizers) { - if (i->optimizer_fn == &dmnsn_png_optimizer_fn) { + if (i->optimizer_fn == dmnsn_png_optimizer_fn) { for (size_t y = 0; y < height; ++y) { /* Invert the rows. PNG coordinates are fourth quadrant. */ uint16_t *row = (uint16_t *)i->ptr + 4*(height - y - 1)*width; @@ -399,7 +399,7 @@ dmnsn_png_read_canvas_thread(void *ptr) int number_of_passes = png_set_interlace_handling(png_ptr); dmnsn_set_progress_total(payload->progress, (number_of_passes + 1)*height); - png_set_read_status_fn(png_ptr, &dmnsn_png_read_row_callback); + png_set_read_status_fn(png_ptr, dmnsn_png_read_row_callback); /* * - Convert paletted images to RGB. diff --git a/libdimension/point_light.c b/libdimension/point_light.c index 2cbc5d9..8617791 100644 --- a/libdimension/point_light.c +++ b/libdimension/point_light.c @@ -42,8 +42,8 @@ dmnsn_new_point_light(dmnsn_vector x0, dmnsn_color color) *ptr = color; light->x0 = x0; - light->light_fn = &dmnsn_point_light_fn; - light->free_fn = &dmnsn_free; + light->light_fn = dmnsn_point_light_fn; + light->free_fn = dmnsn_free; light->ptr = ptr; return light; diff --git a/libdimension/profile.c b/libdimension/profile.c index ae3a4bb..f9dd2d9 100644 --- a/libdimension/profile.c +++ b/libdimension/profile.c @@ -68,7 +68,7 @@ dmnsn_delete_thread_profile(void *ptr) if (pthread_mutex_lock(&dmnsn_profile_mutex) != 0) { dmnsn_error("Couldn't lock mutex."); } - dmnsn_dictionary_apply(thread_profile, &dmnsn_profile_globalize); + dmnsn_dictionary_apply(thread_profile, dmnsn_profile_globalize); if (pthread_mutex_unlock(&dmnsn_profile_mutex) != 0) { dmnsn_error("Couldn't unlock mutex."); } @@ -80,8 +80,7 @@ dmnsn_delete_thread_profile(void *ptr) static void dmnsn_initialize_thread_profile(void) { - if (pthread_key_create(&dmnsn_thread_profile, - &dmnsn_delete_thread_profile) + if (pthread_key_create(&dmnsn_thread_profile, dmnsn_delete_thread_profile) != 0) { dmnsn_error("pthread_key_create() failed."); @@ -100,8 +99,7 @@ dmnsn_initialize_thread_profile(void) static dmnsn_dictionary * dmnsn_get_thread_profile(void) { - if (pthread_once(&dmnsn_thread_profile_once, - &dmnsn_initialize_thread_profile) + if (pthread_once(&dmnsn_thread_profile_once, dmnsn_initialize_thread_profile) != 0) { dmnsn_error("pthread_once() failed."); @@ -183,7 +181,7 @@ dmnsn_print_bad_predictions(void) if (pthread_mutex_lock(&dmnsn_profile_mutex) != 0) { dmnsn_error("Couldn't lock mutex."); } - dmnsn_dictionary_apply(dmnsn_profile, &dmnsn_print_bad_prediction); + dmnsn_dictionary_apply(dmnsn_profile, dmnsn_print_bad_prediction); dmnsn_delete_dictionary(dmnsn_profile); dmnsn_profile = NULL; if (pthread_mutex_unlock(&dmnsn_profile_mutex) != 0) { diff --git a/libdimension/prtree.c b/libdimension/prtree.c index 3ee8fb9..69fac24 100644 --- a/libdimension/prtree.c +++ b/libdimension/prtree.c @@ -237,22 +237,22 @@ dmnsn_zmax_prnode_comp(const dmnsn_list_iterator *l, /** Leaf node comparators. */ static dmnsn_list_comparator_fn *dmnsn_object_comparators[6] = { - [DMNSN_XMIN] = &dmnsn_xmin_object_comp, - [DMNSN_YMIN] = &dmnsn_ymin_object_comp, - [DMNSN_ZMIN] = &dmnsn_zmin_object_comp, - [DMNSN_XMAX] = &dmnsn_xmax_object_comp, - [DMNSN_YMAX] = &dmnsn_ymax_object_comp, - [DMNSN_ZMAX] = &dmnsn_zmax_object_comp + [DMNSN_XMIN] = dmnsn_xmin_object_comp, + [DMNSN_YMIN] = dmnsn_ymin_object_comp, + [DMNSN_ZMIN] = dmnsn_zmin_object_comp, + [DMNSN_XMAX] = dmnsn_xmax_object_comp, + [DMNSN_YMAX] = dmnsn_ymax_object_comp, + [DMNSN_ZMAX] = dmnsn_zmax_object_comp }; /** Internal node comparators. */ static dmnsn_list_comparator_fn *dmnsn_prnode_comparators[6] = { - [DMNSN_XMIN] = &dmnsn_xmin_prnode_comp, - [DMNSN_YMIN] = &dmnsn_ymin_prnode_comp, - [DMNSN_ZMIN] = &dmnsn_zmin_prnode_comp, - [DMNSN_XMAX] = &dmnsn_xmax_prnode_comp, - [DMNSN_YMAX] = &dmnsn_ymax_prnode_comp, - [DMNSN_ZMAX] = &dmnsn_zmax_prnode_comp + [DMNSN_XMIN] = dmnsn_xmin_prnode_comp, + [DMNSN_YMIN] = dmnsn_ymin_prnode_comp, + [DMNSN_ZMIN] = dmnsn_zmin_prnode_comp, + [DMNSN_XMAX] = dmnsn_xmax_prnode_comp, + [DMNSN_YMAX] = dmnsn_ymax_prnode_comp, + [DMNSN_ZMAX] = dmnsn_zmax_prnode_comp }; /** Select an extreme node based on a comparator. */ diff --git a/libdimension/raytrace.c b/libdimension/raytrace.c index dbd0af3..23ccd4e 100644 --- a/libdimension/raytrace.c +++ b/libdimension/raytrace.c @@ -61,7 +61,7 @@ dmnsn_raytrace_scene_async(dmnsn_scene *scene) payload->progress = progress; payload->scene = scene; - dmnsn_new_thread(progress, &dmnsn_raytrace_scene_thread, payload); + dmnsn_new_thread(progress, dmnsn_raytrace_scene_thread, payload); return progress; } @@ -89,7 +89,7 @@ dmnsn_raytrace_scene_thread(void *ptr) /* Time the render itself */ payload->scene->render_timer = dmnsn_new_timer(); - int ret = dmnsn_execute_concurrently(&dmnsn_raytrace_scene_concurrent, + int ret = dmnsn_execute_concurrently(dmnsn_raytrace_scene_concurrent, payload, payload->scene->nthreads); dmnsn_complete_timer(payload->scene->render_timer); @@ -187,9 +187,9 @@ dmnsn_raytrace_scene_concurrent(void *ptr, unsigned int thread, /** Call the appropriate overloaded texture callback. */ #define TEXTURE_CALLBACK(state, telem, fn, def, ...) \ (CAN_CALL(ITEXTURE(state), telem, fn) \ - ? (*ITEXTURE(state)->telem->fn)(ITEXTURE(state)->telem, __VA_ARGS__) \ + ? ITEXTURE(state)->telem->fn(ITEXTURE(state)->telem, __VA_ARGS__) \ : (CAN_CALL(DTEXTURE(state), telem, fn) \ - ? (*DTEXTURE(state)->telem->fn)(DTEXTURE(state)->telem, __VA_ARGS__) \ + ? DTEXTURE(state)->telem->fn(DTEXTURE(state)->telem, __VA_ARGS__) \ : def)); /** Get a property from a texture element. */ @@ -250,7 +250,7 @@ dmnsn_raytrace_light_ray(const dmnsn_raytrace_state *state, * dmnsn_vector_dot(state->viewer, state->intersection->normal) < 0.0) return dmnsn_black; - dmnsn_color color = (*light->light_fn)(light, state->r); + dmnsn_color color = light->light_fn(light, state->r); unsigned int reclevel = state->reclevel; while (reclevel) { diff --git a/libdimension/reflective.c b/libdimension/reflective.c index 304843e..32bec58 100644 --- a/libdimension/reflective.c +++ b/libdimension/reflective.c @@ -60,8 +60,8 @@ dmnsn_new_reflective_finish(dmnsn_color min, dmnsn_color max, double falloff) params->falloff = falloff; finish->ptr = params; - finish->reflection_fn = &dmnsn_reflective_finish_fn; - finish->free_fn = &dmnsn_free; + finish->reflection_fn = dmnsn_reflective_finish_fn; + finish->free_fn = dmnsn_free; return finish; } diff --git a/libdimension/sky_sphere.c b/libdimension/sky_sphere.c index ec3fe2e..9643feb 100644 --- a/libdimension/sky_sphere.c +++ b/libdimension/sky_sphere.c @@ -64,7 +64,7 @@ dmnsn_sky_sphere_color(const dmnsn_sky_sphere *sky_sphere, dmnsn_vector d) DMNSN_ARRAY_FOREACH (const dmnsn_pigment **, pigment, sky_sphere->pigments) { dmnsn_pigment_fn *pigment_fn = (*pigment)->pigment_fn; if (pigment_fn) { - dmnsn_color sky = (*pigment_fn)(*pigment, d); + dmnsn_color sky = pigment_fn(*pigment, d); color = dmnsn_color_add(dmnsn_color_filter(color, sky), sky); } } diff --git a/libdimension/solid_pigment.c b/libdimension/solid_pigment.c index 8d0c27e..f53c5dc 100644 --- a/libdimension/solid_pigment.c +++ b/libdimension/solid_pigment.c @@ -43,8 +43,8 @@ dmnsn_new_solid_pigment(dmnsn_color color) dmnsn_color *solid = dmnsn_malloc(sizeof(dmnsn_color)); *solid = color; - pigment->pigment_fn = &dmnsn_solid_pigment_fn; - pigment->free_fn = &dmnsn_free; + pigment->pigment_fn = dmnsn_solid_pigment_fn; + pigment->free_fn = dmnsn_free; pigment->quick_color = color; pigment->ptr = solid; diff --git a/libdimension/sphere.c b/libdimension/sphere.c index 251fda8..5d937bd 100644 --- a/libdimension/sphere.c +++ b/libdimension/sphere.c @@ -65,8 +65,8 @@ dmnsn_object * dmnsn_new_sphere(void) { dmnsn_object *sphere = dmnsn_new_object(); - sphere->intersection_fn = &dmnsn_sphere_intersection_fn; - sphere->inside_fn = &dmnsn_sphere_inside_fn; + sphere->intersection_fn = dmnsn_sphere_intersection_fn; + sphere->inside_fn = dmnsn_sphere_inside_fn; sphere->bounding_box.min = dmnsn_new_vector(-1.0, -1.0, -1.0); sphere->bounding_box.max = dmnsn_new_vector(1.0, 1.0, 1.0); return sphere; diff --git a/libdimension/threads.c b/libdimension/threads.c index eb5e0aa..00f0e33 100644 --- a/libdimension/threads.c +++ b/libdimension/threads.c @@ -51,9 +51,9 @@ dmnsn_thread(void *arg) dmnsn_thread_payload *payload = arg; int *ret; - pthread_cleanup_push(&dmnsn_thread_cleanup, payload); + pthread_cleanup_push(dmnsn_thread_cleanup, payload); ret = dmnsn_malloc(sizeof(int)); - *ret = (*payload->thread_fn)(payload->arg); + *ret = payload->thread_fn(payload->arg); pthread_cleanup_pop(1); return ret; } @@ -67,7 +67,7 @@ dmnsn_new_thread(dmnsn_progress *progress, dmnsn_thread_fn *thread_fn, payload->arg = arg; payload->progress = progress; - if (pthread_create(&progress->thread, NULL, &dmnsn_thread, payload) != 0) { + if (pthread_create(&progress->thread, NULL, dmnsn_thread, payload) != 0) { dmnsn_error("Couldn't start thread."); } } @@ -84,8 +84,8 @@ static void * dmnsn_concurrent_thread(void *ptr) { dmnsn_concurrent_thread_payload *payload = ptr; - payload->ret = (*payload->thread_fn)(payload->arg, payload->thread, - payload->nthreads); + payload->ret = payload->thread_fn(payload->arg, payload->thread, + payload->nthreads); return NULL; } @@ -102,7 +102,7 @@ dmnsn_execute_concurrently(dmnsn_concurrent_thread_fn *thread_fn, payloads[i].thread = i; payloads[i].nthreads = nthreads; payloads[i].ret = -1; - if (pthread_create(&threads[i], NULL, &dmnsn_concurrent_thread, + if (pthread_create(&threads[i], NULL, dmnsn_concurrent_thread, &payloads[i]) != 0) { dmnsn_error("Couldn't start worker thread."); diff --git a/libdimension/torus.c b/libdimension/torus.c index 150f0f4..852102e 100644 --- a/libdimension/torus.c +++ b/libdimension/torus.c @@ -145,8 +145,8 @@ dmnsn_object * dmnsn_new_torus(double major, double minor) { dmnsn_object *torus = dmnsn_new_object(); - torus->intersection_fn = &dmnsn_torus_intersection_fn; - torus->inside_fn = &dmnsn_torus_inside_fn; + torus->intersection_fn = dmnsn_torus_intersection_fn; + torus->inside_fn = dmnsn_torus_inside_fn; torus->bounding_box.min = dmnsn_new_vector(-(major + minor), -minor, -(major + minor)); @@ -158,6 +158,6 @@ dmnsn_new_torus(double major, double minor) payload->major = major; payload->minor = minor; torus->ptr = payload; - torus->free_fn = &dmnsn_free; + torus->free_fn = dmnsn_free; return torus; } diff --git a/tests/libdimension/list.c b/tests/libdimension/list.c index 49f2cf7..e70d943 100644 --- a/tests/libdimension/list.c +++ b/tests/libdimension/list.c @@ -56,7 +56,7 @@ main(void) } /* Ensure that sorting works */ - dmnsn_list_sort(list, &dmnsn_comparator); + dmnsn_list_sort(list, dmnsn_comparator); for (dmnsn_list_iterator *i = dmnsn_list_first(list); i != dmnsn_list_last(list); i = dmnsn_list_next(i)) diff --git a/tests/libdimension/prtree.c b/tests/libdimension/prtree.c index 0af358b..da69b97 100644 --- a/tests/libdimension/prtree.c +++ b/tests/libdimension/prtree.c @@ -67,7 +67,7 @@ main(void) for (size_t i = 0; i < nobjects; ++i) { dmnsn_object *object = dmnsn_new_object(); dmnsn_randomize_bounding_box(object); - object->intersection_fn = &dmnsn_fake_intersection_fn; + object->intersection_fn = dmnsn_fake_intersection_fn; dmnsn_initialize_object(object); dmnsn_array_push(scene->objects, &object); } |