Skip to content
Browse files

cjd's editor window is only 100 characters wide :)

  • Loading branch information...
1 parent 49a5d9c commit 6b7f576872ba4b496684a6804d1ffa5b3763112f Caleb James DeLisle committed
View
4 admin/AdminClient.c
@@ -124,7 +124,9 @@ static void doCall(Dict* message, struct Result* res, bool getCookie)
if (!getCookie) {
calculateAuth(message, res->ctx->password, cookie, res->alloc);
- writer = ArrayWriter_new(res->public.messageBytes, AdminClient_MAX_MESSAGE_SIZE, res->alloc);
+ writer = ArrayWriter_new(res->public.messageBytes,
+ AdminClient_MAX_MESSAGE_SIZE,
+ res->alloc);
if (StandardBencSerializer_get()->serializeDictionary(writer, message)) {
res->public.err = AdminClient_Error_SERIALIZATION_FAILED;
return;
View
6 admin/AuthorizedPasswords.c
@@ -48,7 +48,8 @@ static void add(Dict* args, void* vcontext, String* txid)
if (!(passwd && authType)) {
sendResponse(String_CONST("Must specify authType, and password."), context->admin, txid);
} else if (*authType < 1 || *authType > 255) {
- sendResponse(String_CONST("Auth must be between 1 and 255 inclusive."), context->admin, txid);
+ sendResponse(String_CONST("Auth must be between 1 and 255 inclusive."),
+ context->admin, txid);
} else {
struct User* u = context->allocator->malloc(sizeof(struct User), context->allocator);
// At some point this will be implemented...
@@ -65,7 +66,8 @@ static void add(Dict* args, void* vcontext, String* txid)
txid);
break;
case CryptoAuth_addUser_OUT_OF_SPACE:
- sendResponse(String_CONST("Out of memory to store password."), context->admin, txid);
+ sendResponse(String_CONST("Out of memory to store password."),
+ context->admin, txid);
break;
case CryptoAuth_addUser_DUPLICATE:
sendResponse(String_CONST("Password already added."), context->admin, txid);
View
3 benc/Dict.c
@@ -98,7 +98,8 @@ Dict* Dict_new(const struct Allocator* allocator)
* only add a pointer to it in the dictionary.
* If dictionary is NULL then a new dictionary will be created and returned.
*
- * @param dictionary this must be a bencoded dictionary or NULL, if NULL then a new dictionary is made.
+ * @param dictionary this must be a bencoded dictionary or NULL, if NULL then a new dictionary
+ is made.
* @param key the reference key to use for putting the entry in the dictionary.
* @param value the value to insert with the key.
* @param allocator the means to get memory for storing the dictionary entry wrapper.
View
3 benc/serialization/BencSerializer.h
@@ -117,7 +117,8 @@ struct BencSerializer
* dictionary and will leave the read pointer on the first character AFTER
* the 'e' which ends the dictionary.
* @param allocator a Allocator which will be used to store data.
- * @param output a dictionary pointer which will be set to the output. Dict* out = NULL; is enough.
+ * @param output a dictionary pointer which will be set to the output. Dict* out = NULL;
+ is enough.
* @return 0 if everything goes well -2 if -1 returned by read indicating an array underflow,
* -3 if content unparsable.
*/
View
6 benc/serialization/json/JsonBencSerializer.c
@@ -260,7 +260,8 @@ static inline int parseComment(const struct Reader* reader)
case '/':;
return readUntil('\n', reader);
default:
- printf("Warning: expected a comment starting with \"//\" or \"/*\", instead found \"/%c\"\n",chars[1]);
+ printf("Warning: expected a comment starting with \"//\" or \"/*\", "
+ "instead found \"/%c\"\n",chars[1]);
return UNPARSABLE;
}
}
@@ -509,7 +510,8 @@ static int32_t parseGeneric(const struct Reader* reader,
break;
default:
- printf("While looking for something to parse: expected one of 0 1 2 3 4 5 6 7 8 9 [ { \", found '%c'\n", firstChar);
+ printf("While looking for something to parse: "
+ "expected one of 0 1 2 3 4 5 6 7 8 9 [ { \", found '%c'\n", firstChar);
return UNPARSABLE;
}
View
2 cjdroute.c
@@ -171,7 +171,7 @@ static int genconf()
" ],\n"
"\n"
" // Settings for administering and extracting information from your router.\n"
- " // This interface provides API functions which can be called through a TCP socket.\n"
+ " // This interface provides functions which can be called through a TCP socket.\n"
" \"admin\":\n"
" {\n"
" // Port to bind the admin RPC server to.\n"
View
5 crypto/test/CryptoAuth_unit_test.c
@@ -113,7 +113,10 @@ struct CryptoAuth_Wrapper* setUp(uint8_t* myPrivateKey,
});
struct CryptoAuth_Wrapper* wrapper =
- allocator->clone(sizeof(struct CryptoAuth_Wrapper), allocator, &(struct CryptoAuth_Wrapper) {
+ allocator->clone(sizeof(struct CryptoAuth_Wrapper),
+ allocator,
+ &(struct CryptoAuth_Wrapper)
+ {
.context = ca,
.wrappedInterface = iface
});
View
5 dht/Address.h
@@ -99,8 +99,9 @@ static inline bool Address_isSameIp(const struct Address* addr,
return memcmp(addr->key, addr2->key, Address_KEY_SIZE) == 0;
}
-static inline bool Address_equalsSearchTarget(struct Address* addr,
- const uint8_t searchTarget[Address_SEARCH_TARGET_SIZE])
+static inline bool Address_equalsSearchTarget(
+ struct Address* addr,
+ const uint8_t searchTarget[Address_SEARCH_TARGET_SIZE])
{
Address_getPrefix(addr);
return memcmp(addr->ip6.bytes, searchTarget, Address_SEARCH_TARGET_SIZE);
View
3 dht/AddressMapper.h
@@ -22,7 +22,8 @@
* When an item is used, it is relocated to the head. Searching from the
* head therefore means items will be checked in most-recently-used order.
*
- * When inserting a new item, the item to replace - the least-recently-used item - is simply the tail.
+ * When inserting a new item,
+ * the item to replace - the least-recently-used item - is simply the tail.
* Then the tail is set to be the head, because it is the most recently used item.
*/
View
5 dht/ReplyModule.c
@@ -63,7 +63,10 @@ static int handleIncoming(struct DHTMessage* message, void* vcontext)
struct DHTModuleRegistry* registry = (struct DHTModuleRegistry*) vcontext;
struct DHTMessage* reply =
- message->allocator->clone(sizeof(struct DHTMessage), message->allocator, &(struct DHTMessage) {
+ message->allocator->clone(sizeof(struct DHTMessage),
+ message->allocator,
+ &(struct DHTMessage)
+ {
.replyTo = message,
.address = message->address,
.allocator = message->allocator
View
13 dht/dhtcore/NodeCollector.h
@@ -57,15 +57,16 @@ struct NodeCollector
/**
* Create a new NodeCollector.
- * This will create a collector which sifts through nodes and finds the best nodes to serve a request.
- * Nodes which have the lowest distance:reach ratio will be collected.
+ * This will create a collector which sifts through nodes and finds the best nodes to serve a
+ * request. Nodes which have the lowest distance:reach ratio will be collected.
*
* @param targetAddress the address we are searching for.
- * @param capacity the number of nodes to collect, if less than this number are added, some of the nodes
- * will remain NULL pointers.
+ * @param capacity the number of nodes to collect, if less than this number are added, some of
+ * the nodes will remain NULL pointers.
* @param thisNodeAddress this node's address.
- * @param allowNodesFartherThanUs if true then return nodes which are farther than the target then we are.
- * this is required for searches but unallowable for answering queries.
+ * @param allowNodesFartherThanUs if true then return nodes which are farther than the target
+ * then we are. this is required for searches but unallowable
+ * for answering queries.
* @param logger
* @param allocator the means of getting memory to store the collector.
* @return a new collector.
View
5 dht/dhtcore/NodeStore.h
@@ -72,8 +72,9 @@ struct NodeList* NodeStore_getNodesByAddr(struct Address* address,
* @param requestorsAddress if not NULL no responses will be returned which are
* closer to this node in physical space.
* @param count the number of nodes to return.
- * @param allowNodesFartherThanUs if true then return nodes which are farther than the target then we are.
- * this is required for searches but unallowable for answering queries.
+ * @param allowNodesFartherThanUs if true then return nodes which are farther than the target
+ * then we are. this is required for searches but unallowable
+ * for answering queries.
* @param allocator the memory allocator to use for getting the memory to store the output.
*/
struct NodeList* NodeStore_getClosestNodes(struct NodeStore* store,
View
4 dht/dhtcore/test/SearchStore_test.c
@@ -25,7 +25,9 @@ int main()
srand(time(NULL));
char buffer[1024];
struct Allocator* allocator = BufferAllocator_new(buffer, 1024);
- struct SearchNodeIndex index = {rand() % SearchStore_MAX_SEARCHES, rand() % SearchStore_SEARCH_NODES};
+ struct SearchNodeIndex index = {
+ rand() % SearchStore_MAX_SEARCHES, rand() % SearchStore_SEARCH_NODES
+ };
String* str = tidForSearchNodeIndex(&index, allocator);
struct SearchNodeIndex index2 = searchNodeIndexForTid(str);
if (index.search - index2.search + index.node - index2.node) {
View
21 dht/dhtcore/test/TestFramework.h
@@ -26,10 +26,11 @@ __attribute__((unused));
static void TestFramework_registerBouncerModule(struct DHTModuleRegistry* registry,
const struct Allocator* allocator)
{
- struct DHTModule* module = allocator->clone(sizeof(struct DHTModule), allocator, &(struct DHTModule) {
- .context = registry,
- .handleIncoming = bounceMessage
- });
+ struct DHTModule* module =
+ allocator->clone(sizeof(struct DHTModule), allocator, &(struct DHTModule) {
+ .context = registry,
+ .handleIncoming = bounceMessage
+ });
DHTModules_register(module, registry);
}
@@ -37,10 +38,11 @@ static void TestFramework_registerOutputCatcher(struct DHTMessage** messagePoint
struct DHTModuleRegistry* registry,
const struct Allocator* allocator)
{
- struct DHTModule* module = allocator->clone(sizeof(struct DHTModule), allocator, &(struct DHTModule) {
- .context = messagePointer,
- .handleOutgoing = catchOutgoing
- });
+ struct DHTModule* module =
+ allocator->clone(sizeof(struct DHTModule), allocator, &(struct DHTModule) {
+ .context = messagePointer,
+ .handleOutgoing = catchOutgoing
+ });
DHTModules_register(module, registry);
}
@@ -49,7 +51,8 @@ static void TestFramework_registerOutputCatcher(struct DHTMessage** messagePoint
static int bounceMessage(struct DHTMessage* message, void* vcontext)
{
struct DHTModuleRegistry* registry = (struct DHTModuleRegistry*) vcontext;
- struct DHTMessage* reply = message->allocator->malloc(sizeof(struct DHTMessage), message->allocator);
+ struct DHTMessage* reply =
+ message->allocator->malloc(sizeof(struct DHTMessage), message->allocator);
reply->replyTo = message;
reply->allocator = message->allocator;
reply->asDict = Dict_new(reply->allocator);
View
3 interface/TUNInterface.c
@@ -66,7 +66,8 @@ static int openTunnel(const char* interfaceName, char assignedInterfaceName[IFNA
if (sscanf(interfaceName, "utun%i", &parsedUnit) != 1 || parsedUnit < 0) {
fprintf(stderr, "Invalid utun device %s. "
- "Remove this configuration parameter to use automatic assignment.\n", interfaceName);
+ "Remove this configuration parameter to use automatic assignment.\n",
+ interfaceName);
return -1;
}
View
11 interface/UDPInterface.c
@@ -225,7 +225,8 @@ int UDPInterface_beginConnection(const char* address,
uint8_t key[InterfaceController_KEY_SIZE];
keyForSockaddr(key, (struct sockaddr_in*) &addr, udpif);
- return InterfaceController_insertEndpoint(key, cryptoKey, password, &udpif->interface, udpif->ic);
+ return
+ InterfaceController_insertEndpoint(key, cryptoKey, password, &udpif->interface, udpif->ic);
}
static void beginConnectionAdmin(Dict* args, void* vcontext, String* txid)
@@ -318,7 +319,10 @@ struct UDPInterface* UDPInterface_new(struct event_base* base,
struct sockaddr_storage addr;
if (bindAddr != NULL) {
context->addrLen = sizeof(struct sockaddr_storage);
- if (0 != evutil_parse_sockaddr_port(bindAddr, (struct sockaddr*) &addr, (int*) &context->addrLen)) {
+ if (0 != evutil_parse_sockaddr_port(bindAddr,
+ (struct sockaddr*) &addr,
+ (int*) &context->addrLen))
+ {
exHandler->exception(__FILE__ " UDPInterface_new() Failed to parse address.",
-1, exHandler);
return NULL;
@@ -349,7 +353,8 @@ struct UDPInterface* UDPInterface_new(struct event_base* base,
context->socket = socket(addrFam, SOCK_DGRAM, 0);
if (context->socket == -1) {
- exHandler->exception(__FILE__ " UDPInterface_new() call to socket() failed.", -3, exHandler);
+ exHandler->exception(__FILE__ " UDPInterface_new() call to socket() failed.",
+ -3, exHandler);
return NULL;
}
View
6 interface/test/InterfaceController_test.c
@@ -128,9 +128,11 @@ static int reconnectionNewEndpointTest(struct InterfaceController* ifController,
Hex_decode((uint8_t*) &label_be, 8, hexBuffer, 16);
uint64_t rev_label = Bits_bitReverse64(Endian_bigEndianToHost64(label_be));
// check label is decoded to 0
- Assert_always(0 == NumberCompress_getDecompressed(rev_label, NumberCompress_bitsUsedForLabel(rev_label)));
+ Assert_always(0 == NumberCompress_getDecompressed(rev_label,
+ NumberCompress_bitsUsedForLabel(rev_label)));
// check no other bits are set
- Assert_always(rev_label == NumberCompress_getCompressed(0, NumberCompress_bitsUsedForLabel(rev_label)));
+ uint64_t out = NumberCompress_getCompressed(0, NumberCompress_bitsUsedForLabel(rev_label));
+ Assert_always(rev_label == out);
return 0;
}
View
6 memory/Allocator.h
@@ -96,7 +96,8 @@ struct Allocator
* @param numberOfBytes how much memory to allocate.
* @param thisAllocator the memory allocator.
* @param toClone a pointer to something which will be cloned into the newly allocated memory,
- * if this is NULL or is not as large as numberOfBytes, undefined behavior will result.
+ * if this is NULL or is not as large as numberOfBytes, undefined behavior will
+ * result.
* @return a pointer to the newly allocated memory.
*/
void* (* const clone)(size_t numberOfBytes,
@@ -108,7 +109,8 @@ struct Allocator
* The allocation will be aligned on the size of a pointer, if you need further alignment then
* you must handle it manually.
*
- * @param originalAllocation a pointer to the original memory allocation which is to be reallocated.
+ * @param originalAllocation a pointer to the original memory allocation which is to be
+ * reallocated.
* @param numberOfBytes how much memory to allocate.
* @param thisAllocator the memory allocator.
* @return a pointer to the newly allocated memory.
View
14 memory/BufferAllocator.c
@@ -99,7 +99,9 @@ static void* allocatorClone(size_t length, const struct Allocator* allocator, co
}
/** @see Allocator->realloc() */
-static void* allocatorRealloc(const void* original, size_t length, const struct Allocator* allocator)
+static void* allocatorRealloc(const void* original,
+ size_t length,
+ const struct Allocator* allocator)
{
if (original == NULL) {
return allocatorMalloc(length, allocator);
@@ -109,10 +111,12 @@ static void* allocatorRealloc(const void* original, size_t length, const struct
struct BufferAllocator_context* context =
(struct BufferAllocator_context*) allocator->context;
char* pointer = context->pointer;
- size_t amountToClone =
- length < (size_t)(pointer - (char*)original) ? length : (size_t)(pointer - (char*)original);
+ size_t amountToClone = (length < (size_t)(pointer - (char*)original))
+ ? length
+ : (size_t)(pointer - (char*)original);
- // The likelyhood of nothing having been allocated since is almost 0 so we will always create a new
+ // The likelyhood of nothing having been allocated since is
+ // almost 0 so we will always create a new
// allocation and copy into it.
void* newAlloc = allocator->malloc(length, allocator);
Bits_memcpy(newAlloc, original, amountToClone);
@@ -231,7 +235,7 @@ struct Allocator* BufferAllocator_new(void* buffer, size_t length)
};
/* Get the pointer to the context where it's written in the buffer. */
- struct BufferAllocator_context* contextPtr = (struct BufferAllocator_context*) allocator.context;
+ struct BufferAllocator_context* contextPtr = allocator.context;
/* have to advance the pointer so as not to clobber the context. */
contextPtr->pointer += sizeof(struct BufferAllocator_context);
View
9 net/Ducttape.c
@@ -168,7 +168,8 @@ static inline bool isRouterTraffic(struct Message* message, struct Headers_IP6He
struct Headers_UDPHeader* uh = (struct Headers_UDPHeader*) message->bytes;
return message->length >= Headers_UDPHeader_SIZE
&& uh->sourceAndDestPorts == 0
- && (int) Endian_bigEndianToHost16(uh->length_be) == message->length - Headers_UDPHeader_SIZE;
+ && (int) Endian_bigEndianToHost16(uh->length_be) ==
+ (message->length - Headers_UDPHeader_SIZE);
}
/**
@@ -638,7 +639,8 @@ static uint8_t incomingFromSwitch(struct Message* message, struct Interface* swi
} else {
#ifdef Log_DEBUG
uint8_t switchAddr[20];
- AddrTools_printPath(switchAddr, Endian_bigEndianToHost64(switchHeader->label_be));
+ AddrTools_printPath(switchAddr,
+ Endian_bigEndianToHost64(switchHeader->label_be));
Log_debug1(context->logger,
"Dropped traffic packet from unknown node. (%s)\n",
&switchAddr);
@@ -689,7 +691,8 @@ struct Ducttape* Ducttape_register(Dict* config,
context->forwardTo = NULL;
AddressMapper_init(&context->addrMap);
- struct CryptoAuth* cryptoAuth = CryptoAuth_new(config, allocator, privateKey, eventBase, logger);
+ struct CryptoAuth* cryptoAuth =
+ CryptoAuth_new(config, allocator, privateKey, eventBase, logger);
CryptoAuth_getPublicKey(context->myAddr.key, cryptoAuth);
Address_getPrefix(&context->myAddr);
View
5 scripts/checkfiles.pl
@@ -88,6 +88,11 @@ sub error {
}
$lineInfo = "$fileName:$lineNum";
+
+ if (length($line) > 100) {
+ error("cjd's editor window is only 100 characters wide");
+ }
+
if ($fileName =~ /\.h$/) {
my $n = $name;
View
59 switch/NumberCompress.h
@@ -34,8 +34,10 @@
/* public interface */
static inline uint32_t NumberCompress_bitsUsedForLabel(const uint64_t label);
static inline uint32_t NumberCompress_bitsUsedForNumber(const uint32_t number);
-static inline uint64_t NumberCompress_getCompressed(const uint32_t number, const uint32_t bitsUsed);
-static inline uint32_t NumberCompress_getDecompressed(const uint64_t label, const uint32_t bitsUsed);
+static inline uint64_t NumberCompress_getCompressed(const uint32_t number,
+ const uint32_t bitsUsed);
+static inline uint32_t NumberCompress_getDecompressed(const uint64_t label,
+ const uint32_t bitsUsed);
// also a constant NumberCompress_INTERFACES defining the maximum number of interfaces
/* Number 1 is always encoded as the 4 bits 0001; and each label ending in 0001 is decoded as
@@ -59,10 +61,12 @@ static inline uint32_t NumberCompress_4_bitsUsedForLabel(const uint64_t label) {
static inline uint32_t NumberCompress_4_bitsUsedForNumber(const uint32_t number) {
return 4;
}
-static inline uint64_t NumberCompress_4_getCompressed(const uint32_t number, const uint32_t bitsUsed) {
+static inline uint64_t NumberCompress_4_getCompressed(const uint32_t number,
+ const uint32_t bitsUsed) {
return number;
}
-static inline uint32_t NumberCompress_4_getDecompressed(const uint64_t label, const uint32_t bitsUsed) {
+static inline uint32_t NumberCompress_4_getDecompressed(const uint64_t label,
+ const uint32_t bitsUsed) {
return label & 0xf;
}
@@ -74,15 +78,21 @@ static inline uint32_t NumberCompress_4_getDecompressed(const uint64_t label, co
// that way XXXX is never 1
// so map numbers 16-239 -> 32-255, and 240 <-> 1, then swap nibbles
# define NumberCompress_8_INTERFACES 241
-static inline uint32_t NumberCompress_8_bitsUsedForLabel(const uint64_t label) {
+static inline uint32_t NumberCompress_8_bitsUsedForLabel(const uint64_t label)
+{
if (1 == (label & 0xf)) return 4;
return 8;
}
-static inline uint32_t NumberCompress_8_bitsUsedForNumber(const uint32_t number) {
+
+static inline uint32_t NumberCompress_8_bitsUsedForNumber(const uint32_t number)
+{
if (1 == number) return 4;
return 8;
}
-static inline uint64_t NumberCompress_8_getCompressed(const uint32_t number, const uint32_t bitsUsed) {
+
+static inline uint64_t NumberCompress_8_getCompressed(const uint32_t number,
+ const uint32_t bitsUsed)
+{
if (1 == number) return 1;
if (240 == number) return 0x10;
uint32_t low = number & 0xf;
@@ -90,7 +100,10 @@ static inline uint64_t NumberCompress_8_getCompressed(const uint32_t number, con
if (high > 0) ++high;
return (low << 4) + high;
}
-static inline uint32_t NumberCompress_8_getDecompressed(const uint64_t label, const uint32_t bitsUsed) {
+
+static inline uint32_t NumberCompress_8_getDecompressed(const uint64_t label,
+ const uint32_t bitsUsed)
+{
uint32_t low = label & 0xf;
if (1 == low) return 1;
if (0x10 == (label & 0xff)) return 240;
@@ -128,7 +141,8 @@ static inline uint32_t NumberCompress_dyn_bitsUsedForNumber(const uint32_t numbe
}
}
-static inline uint64_t NumberCompress_dyn_getCompressed(const uint32_t number, const uint32_t bitsUsed)
+static inline uint64_t NumberCompress_dyn_getCompressed(const uint32_t number,
+ const uint32_t bitsUsed)
{
if (1 == number) return 1;
switch (bitsUsed) {
@@ -147,7 +161,8 @@ static inline uint64_t NumberCompress_dyn_getCompressed(const uint32_t number, c
}
}
-static inline uint32_t NumberCompress_dyn_getDecompressed(const uint64_t label, const uint32_t bitsUsed)
+static inline uint32_t NumberCompress_dyn_getDecompressed(const uint64_t label,
+ const uint32_t bitsUsed)
{
uint32_t number;
switch (bitsUsed) {
@@ -179,10 +194,14 @@ static inline uint32_t NumberCompress_bitsUsedForLabel(const uint64_t label) {
static inline uint32_t NumberCompress_bitsUsedForNumber(const uint32_t number) {
return NumberCompress_4_bitsUsedForNumber(number);
}
-static inline uint64_t NumberCompress_getCompressed(const uint32_t number, const uint32_t bitsUsed) {
+static inline uint64_t NumberCompress_getCompressed(const uint32_t number,
+ const uint32_t bitsUsed)
+{
return NumberCompress_4_getCompressed(number, bitsUsed);
}
-static inline uint32_t NumberCompress_getDecompressed(const uint64_t label, const uint32_t bitsUsed) {
+static inline uint32_t NumberCompress_getDecompressed(const uint64_t label,
+ const uint32_t bitsUsed)
+{
return NumberCompress_4_getDecompressed(label, bitsUsed);
}
@@ -195,10 +214,14 @@ static inline uint32_t NumberCompress_bitsUsedForLabel(const uint64_t label) {
static inline uint32_t NumberCompress_bitsUsedForNumber(const uint32_t number) {
return NumberCompress_8_bitsUsedForNumber(number);
}
-static inline uint64_t NumberCompress_getCompressed(const uint32_t number, const uint32_t bitsUsed) {
+static inline uint64_t NumberCompress_getCompressed(const uint32_t number,
+ const uint32_t bitsUsed)
+{
return NumberCompress_8_getCompressed(number, bitsUsed);
}
-static inline uint32_t NumberCompress_getDecompressed(const uint64_t label, const uint32_t bitsUsed) {
+static inline uint32_t NumberCompress_getDecompressed(const uint64_t label,
+ const uint32_t bitsUsed)
+{
return NumberCompress_8_getDecompressed(label, bitsUsed);
}
@@ -211,10 +234,14 @@ static inline uint32_t NumberCompress_bitsUsedForLabel(const uint64_t label) {
static inline uint32_t NumberCompress_bitsUsedForNumber(const uint32_t number) {
return NumberCompress_dyn_bitsUsedForNumber(number);
}
-static inline uint64_t NumberCompress_getCompressed(const uint32_t number, const uint32_t bitsUsed) {
+static inline uint64_t NumberCompress_getCompressed(const uint32_t number,
+ const uint32_t bitsUsed)
+{
return NumberCompress_dyn_getCompressed(number, bitsUsed);
}
-static inline uint32_t NumberCompress_getDecompressed(const uint64_t label, const uint32_t bitsUsed) {
+static inline uint32_t NumberCompress_getDecompressed(const uint64_t label,
+ const uint32_t bitsUsed)
+{
return NumberCompress_dyn_getDecompressed(label, bitsUsed);
}
View
6 switch/SwitchCore.c
@@ -95,7 +95,8 @@ struct ErrorPacket {
struct Headers_SwitchHeader switchHeader;
struct Control ctrl;
};
-Assert_compileTime(sizeof(struct ErrorPacket) == Headers_SwitchHeader_SIZE + sizeof(struct Control));
+Assert_compileTime(
+ sizeof(struct ErrorPacket) == Headers_SwitchHeader_SIZE + sizeof(struct Control));
static inline void sendError(struct SwitchInterface* iface,
struct Message* cause,
@@ -128,7 +129,8 @@ static inline void sendError(struct SwitchInterface* iface,
err->ctrl.content.error.errorType_be = Endian_hostToBigEndian32(code);
err->ctrl.checksum_be = 0;
- err->ctrl.checksum_be = Checksum_engine((uint8_t*) &err->ctrl, cause->length - Headers_SwitchHeader_SIZE);
+ err->ctrl.checksum_be =
+ Checksum_engine((uint8_t*) &err->ctrl, cause->length - Headers_SwitchHeader_SIZE);
sendMessage(iface, cause, logger);
}
View
6 util/Assert.h
@@ -45,11 +45,13 @@ static inline void Assert_internal(const char* expr, int isTrue, const char* fil
* Prevent compilation if assertion is false or not a compile time constant.
* Thanks to http://www.jaggersoft.com/pubs/CVu11_3.html
*/
-#define Assert_compileTime(isTrue) struct Assert_UNIQUE_NAME { unsigned int assertFailed : (isTrue); }
+#define Assert_compileTime(isTrue) \
+ struct Assert_UNIQUE_NAME { unsigned int assertFailed : (isTrue); }
/** Runtime assertion which is always applied. */
-#define Assert_always(expr) Assert_internal(Assert_STRING(expr), (expr) ? 1 : 0, __FILE__, __LINE__)
+#define Assert_always(expr) \
+ Assert_internal(Assert_STRING(expr), (expr) ? 1 : 0, __FILE__, __LINE__)
// Turn off assertions when the code is more stable.
#define Assert_true(expr) Assert_always(expr)
View
4 util/Pinger.h
@@ -93,7 +93,9 @@ void Pinger_pongReceived(String* data, struct Pinger* pinger);
* @param logger
* @param alloc
*/
-struct Pinger* Pinger_new(struct event_base* eventBase, struct Log* logger, struct Allocator* alloc);
+struct Pinger* Pinger_new(struct event_base* eventBase,
+ struct Log* logger,
+ struct Allocator* alloc);
#endif
View
7 util/Timeout.c
@@ -94,7 +94,12 @@ static struct Timeout* setTimeout(void (* const callback)(void* callbackContext)
timeout->event = (struct event*) &timeout[1];
allocator->onFree(deleteEvent, timeout, allocator);
- event_assign(timeout->event, eventBase, -1, ((interval) ? EV_PERSIST : 0), handleEvent, timeout);
+ event_assign(timeout->event,
+ eventBase,
+ -1,
+ ((interval) ? EV_PERSIST : 0),
+ handleEvent,
+ timeout);
struct timeval time = timeForMilliseconds(milliseconds);
event_add(timeout->event, &time);
View
3 util/test/Bits_test.c
@@ -27,7 +27,8 @@ int main()
printf("x = 0x%016" PRIx64 "\n", x);
Assert_always(Bits_bitReverse64(Bits_bitReverse64(x)) == x);
- Assert_always(Bits_bitReverse64(Endian_byteSwap64(Bits_bitReverse64(x))) == Endian_byteSwap64(x));
+ Assert_always(
+ Bits_bitReverse64(Endian_byteSwap64(Bits_bitReverse64(x))) == Endian_byteSwap64(x));
Assert_always(Bits_bitReverse64(1) == ((uint64_t)1)<<63);
Assert_always(Bits_bitReverse64(0) == 0);
}
View
3 wire/Message.h
@@ -69,7 +69,8 @@ static inline void Message_copyOver(struct Message* output,
static inline bool Message_shift(struct Message* toShift, int32_t amount)
{
Assert_true(toShift->padding >= amount);
- Assert_true((amount >= 0) ? (UINT16_MAX - toShift->length >= amount) : (toShift->length >= -amount));
+ Assert_true(
+ (amount >= 0) ? (UINT16_MAX - toShift->length >= amount) : (toShift->length >= -amount));
Assert_true(toShift->length < 60000);
toShift->length += amount;
toShift->bytes -= amount;

0 comments on commit 6b7f576

Please sign in to comment.
Something went wrong with that request. Please try again.