apply some coding style with astyle

This commit is contained in:
Markus Teich 2016-05-17 22:50:38 +02:00
parent 5fc3e848ce
commit 5b885c1e62
2 changed files with 34 additions and 19 deletions

15
.astylerc Normal file
View File

@ -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

View File

@ -37,7 +37,7 @@ struct brandt_auction;
* @param[in] msg_len The length of the message @a msg in bytes. * @param[in] msg_len The length of the message @a msg in bytes.
* @return 1 on success, 0 on failure. * @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 * 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. * @param[in] msg_len The length of the message @a msg in bytes.
* @return 1 on success, 0 on failure. * @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 * 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 * @param[in] price The price, the winner has to pay or 0 if the auction result
* is private and the user did not win. * 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. * Join an auction described by the @a auction_data parameter.
@ -82,7 +82,7 @@ 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 * 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! * black-box pointer, do NOT access/change it or the data it points to!
*/ */
const struct brandt_auction *brandt_join(brandt_cb_broadcast broadcast, const struct brandt_auction *brandt_join (brandt_cb_broadcast broadcast,
brandt_cb_unicast_seller unicast, brandt_cb_unicast_seller unicast,
brandt_cb_report_result report, brandt_cb_report_result report,
const void *auction_closure, const void *auction_closure,
@ -114,7 +114,7 @@ const struct brandt_auction *brandt_join(brandt_cb_broadcast broadcast,
* libbrandt functions when the client needs to refer to this auction. This is a * 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! * black-box pointer, do NOT access/change it or the data it points to!
*/ */
const struct brandt_auction *brandt_new(brandt_cb_broadcast broadcast, const struct brandt_auction *brandt_new (brandt_cb_broadcast broadcast,
brandt_cb_report_result report, brandt_cb_report_result report,
const void *auction_closure, const void *auction_closure,
const void **auction_data, const void **auction_data,
@ -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 The message that was received.
* @param[in] msg_len The length in bytes of @a msg. * @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. * 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. * @param[in] msg_len The length in bytes of @a msg.
* TODO: how to link message to sender id within auction? * 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? ///TODO: Error handling functions?