From 5b885c1e62c9132f9bbcd8fc75a4b154b9765a99 Mon Sep 17 00:00:00 2001 From: Markus Teich Date: Tue, 17 May 2016 22:50:38 +0200 Subject: [PATCH] apply some coding style with astyle --- .astylerc | 15 +++++++++++++++ brandt.h | 38 +++++++++++++++++++------------------- 2 files changed, 34 insertions(+), 19 deletions(-) create mode 100644 .astylerc diff --git a/.astylerc b/.astylerc new file mode 100644 index 0000000..58cc7e4 --- /dev/null +++ b/.astylerc @@ -0,0 +1,15 @@ +--mode=c + +--style=bsd # brackets on their own line + +--indent=tab # tabs for indentation, spaces for alignment + +--min-conditional-indent=0 # align continuation lines to the opening bracket + +--max-instatement-indent=80 # allow to use a lot of spaces for alignment + +--pad-oper # operators + have - spaces + +--pad-first-paren-out # space before ( + +--align-pointer=name # char *name diff --git a/brandt.h b/brandt.h index 47afcfc..a8a2dff 100644 --- a/brandt.h +++ b/brandt.h @@ -37,7 +37,7 @@ struct brandt_auction; * @param[in] msg_len The length of the message @a msg in bytes. * @return 1 on success, 0 on failure. */ -typedef int (*brandt_cb_broadcast)(void *auction_closure, const void *msg, size_t msg_len); +typedef int (*brandt_cb_broadcast) (void *auction_closure, const void *msg, size_t msg_len); /** * Functions of this type are called by libbrandt to unicast messages to the @@ -51,7 +51,7 @@ typedef int (*brandt_cb_broadcast)(void *auction_closure, const void *msg, size_ * @param[in] msg_len The length of the message @a msg in bytes. * @return 1 on success, 0 on failure. */ -typedef int (*brandt_cb_unicast_seller)(void *auction_closure, const void *msg, size_t msg_len); +typedef int (*brandt_cb_unicast_seller) (void *auction_closure, const void *msg, size_t msg_len); /** * Functions of this type are called by libbrandt to report the auction outcome @@ -65,7 +65,7 @@ typedef int (*brandt_cb_unicast_seller)(void *auction_closure, const void *msg, * @param[in] price The price, the winner has to pay or 0 if the auction result * is private and the user did not win. */ -typedef void (*brandt_cb_report_result)(void *auction_closure, int won, uint16_t price); +typedef void (*brandt_cb_report_result) (void *auction_closure, int won, uint16_t price); /** * Join an auction described by the @a auction_data parameter. @@ -82,12 +82,12 @@ typedef void (*brandt_cb_report_result)(void *auction_closure, int won, uint16_t * libbrandt functions when the client needs to refer to this auction. This is a * black-box pointer, do NOT access/change it or the data it points to! */ -const struct brandt_auction *brandt_join(brandt_cb_broadcast broadcast, - brandt_cb_unicast_seller unicast, - brandt_cb_report_result report, - const void *auction_closure, - const void *auction_data, - size_t auction_data_len); +const struct brandt_auction *brandt_join (brandt_cb_broadcast broadcast, + brandt_cb_unicast_seller unicast, + brandt_cb_report_result report, + const void *auction_closure, + const void *auction_data, + size_t auction_data_len); /** * Create a new auction described by the @a auction_data parameter. @@ -114,14 +114,14 @@ const struct brandt_auction *brandt_join(brandt_cb_broadcast broadcast, * libbrandt functions when the client needs to refer to this auction. This is a * black-box pointer, do NOT access/change it or the data it points to! */ -const struct brandt_auction *brandt_new(brandt_cb_broadcast broadcast, - brandt_cb_report_result report, - const void *auction_closure, - const void **auction_data, - size_t *auction_data_len, - uint16_t num_prices, - uint16_t m, - int outcome_public); +const struct brandt_auction *brandt_new (brandt_cb_broadcast broadcast, + brandt_cb_report_result report, + const void *auction_closure, + const void **auction_data, + size_t *auction_data_len, + uint16_t num_prices, + uint16_t m, + int outcome_public); /** * Receive a broadcast message related to a specific auction. @@ -130,7 +130,7 @@ const struct brandt_auction *brandt_new(brandt_cb_broadcast broadcast, * @param[in] msg The message that was received. * @param[in] msg_len The length in bytes of @a msg. */ -void brandt_got_broadcast(struct brandt_auction *auction, void *msg, size_t msg_len); +void brandt_got_broadcast (struct brandt_auction *auction, void *msg, size_t msg_len); /** * Receive a unicast message from a bidder related to a specific auction. @@ -140,7 +140,7 @@ void brandt_got_broadcast(struct brandt_auction *auction, void *msg, size_t msg_ * @param[in] msg_len The length in bytes of @a msg. * TODO: how to link message to sender id within auction? */ -void brandt_got_unicast(struct brandt_auction *auction, void *msg, size_t msg_len); +void brandt_got_unicast (struct brandt_auction *auction, void *msg, size_t msg_len); ///TODO: Error handling functions?