aboutsummaryrefslogtreecommitdiff
path: root/src/io
diff options
context:
space:
mode:
authorJ08nY2018-03-03 01:17:16 +0100
committerJ08nY2018-03-03 01:17:16 +0100
commit1f0f281a8a0ee8d4114a7f1df6c762f20e935746 (patch)
tree9afd927280f2da4dcf9fda9ce3a9c24ed135ff8c /src/io
parentac60f78a253efde94cab36264b0555b0691fdd8a (diff)
downloadecgen-1f0f281a8a0ee8d4114a7f1df6c762f20e935746.tar.gz
ecgen-1f0f281a8a0ee8d4114a7f1df6c762f20e935746.tar.zst
ecgen-1f0f281a8a0ee8d4114a7f1df6c762f20e935746.zip
Diffstat (limited to 'src/io')
-rw-r--r--src/io/output.c24
1 files changed, 12 insertions, 12 deletions
diff --git a/src/io/output.c b/src/io/output.c
index 6fb82d3..2130614 100644
--- a/src/io/output.c
+++ b/src/io/output.c
@@ -19,27 +19,23 @@ char *output_malloc(const char *what) {
return s;
}
-
static JSON_Value *output_json_point(point_t *point) {
JSON_Value *point_value = json_value_init_object();
JSON_Object *point_object = json_value_get_object(point_value);
- char *x = pari_sprintf(
- "%P0#*x", cfg->hex_digits,
- field_elementi(gel(point->point, 1)));
+ char *x = pari_sprintf("%P0#*x", cfg->hex_digits,
+ field_elementi(gel(point->point, 1)));
json_object_set_string(point_object, "x", x);
pari_free(x);
- char *y = pari_sprintf(
- "%P0#*x", cfg->hex_digits,
- field_elementi(gel(point->point, 2)));
+ char *y = pari_sprintf("%P0#*x", cfg->hex_digits,
+ field_elementi(gel(point->point, 2)));
json_object_set_string(point_object, "y", y);
pari_free(y);
char *p_order = pari_sprintf("%P#x", point->order);
json_object_set_string(point_object, "order", p_order);
pari_free(p_order);
if (point->cofactor) {
- char *cofactor =
- pari_sprintf("%P#x", point->cofactor);
+ char *cofactor = pari_sprintf("%P#x", point->cofactor);
json_object_set_string(point_object, "cofactor", cofactor);
pari_free(cofactor);
}
@@ -105,14 +101,18 @@ static JSON_Value *output_jjson(curve_t *curve) {
JSON_Array *gens_array = json_value_get_array(gens_value);
for (size_t i = 0; i < curve->ngens; ++i) {
- JSON_Value *gen_value = output_json_point(curve->generators[i]->generator);
+ JSON_Value *gen_value =
+ output_json_point(curve->generators[i]->generator);
JSON_Object *gen_object = json_value_get_object(gen_value);
if (curve->generators[i]->npoints) {
JSON_Value *gens_points_value = json_value_init_array();
- JSON_Array *gens_points_array = json_value_get_array(gens_points_value);
+ JSON_Array *gens_points_array =
+ json_value_get_array(gens_points_value);
for (size_t j = 0; j < curve->generators[i]->npoints; ++j) {
- json_array_append_value(gens_points_array, output_json_point(curve->generators[i]->points[j]));
+ json_array_append_value(
+ gens_points_array,
+ output_json_point(curve->generators[i]->points[j]));
}
json_object_set_value(gen_object, "points", gens_points_value);
}