Skip to content

Commit

Permalink
Format code use clang-format
Browse files Browse the repository at this point in the history
  • Loading branch information
TheWaWaR committed Jan 8, 2021
1 parent c79694a commit 6bc7ff4
Show file tree
Hide file tree
Showing 11 changed files with 691 additions and 759 deletions.
3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,9 @@ build/godwoken.h: ${PROTOCOL_SCHEMA_DIR}/godwoken.mol
mkdir -p build
${MOLC} --language c --schema-file $< > $@

fmt:
clang-format -i -style=Google c/**/*.*

clean:
rm -rf build/*
cd $(SECP_DIR) && [ -f "Makefile" ] && make distclean && make clean
Expand Down
570 changes: 279 additions & 291 deletions c/contracts.h

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions c/dump_secp256k1_data.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#include <stdio.h>

#include "blake2b.h"

/*
Expand Down
4 changes: 1 addition & 3 deletions c/generator.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,4 @@

#include "polyjuice.h"

int main() {
return run_polyjuice();
}
int main() { return run_polyjuice(); }
7 changes: 4 additions & 3 deletions c/generator/secp256k1_helper.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,12 @@ void secp256k1_default_error_callback_fn(const char* str, void* data) {
* data should at least be CKB_SECP256K1_DATA_SIZE big
* so as to hold all loaded data.
*/
int ckb_secp256k1_custom_verify_only_initialize(gw_context_t *ctx,
int ckb_secp256k1_custom_verify_only_initialize(gw_context_t* ctx,
secp256k1_context* context,
void* data) {
uint32_t len = 0;
int ret = ctx->sys_load_data(ctx, ckb_secp256k1_data_hash, &len, 0, (uint8_t *)data);
int ret =
ctx->sys_load_data(ctx, ckb_secp256k1_data_hash, &len, 0, (uint8_t*)data);
if (ret != 0 || len != CKB_SECP256K1_DATA_SIZE) {
return CKB_SECP256K1_HELPER_ERROR_LOADING_DATA;
}
Expand All @@ -48,7 +49,7 @@ int ckb_secp256k1_custom_verify_only_initialize(gw_context_t *ctx,
secp256k1_ecmult_gen_context_init(&context->ecmult_gen_ctx);

/* Recasting data to (uint8_t*) for pointer math */
uint8_t* p = (uint8_t *)data;
uint8_t* p = (uint8_t*)data;
secp256k1_ge_storage(*pre_g)[] = (secp256k1_ge_storage(*)[])p;
secp256k1_ge_storage(*pre_g_128)[] =
(secp256k1_ge_storage(*)[])(&p[CKB_SECP256K1_DATA_PRE_SIZE]);
Expand Down
Loading

0 comments on commit 6bc7ff4

Please sign in to comment.