From 38529e32964511c61fcce8391d10bf00d6576f60 Mon Sep 17 00:00:00 2001 From: Christian Mehlis <mehlis@inf.fu-berlin.de> Date: Fri, 14 Feb 2014 17:47:33 +0100 Subject: [PATCH] replace all endless for loops by while --- cpu/lpc2387/mci/lpc2387-mci.c | 2 +- examples/rpl_udp/udp.c | 2 +- sys/crypto/aes/aes.c | 4 ++-- sys/net/ccn_lite/ccnl-core.c | 2 +- sys/net/ccn_lite/ccnl-ext-mgmt.c | 2 +- sys/semaphore/semaphore.c | 2 +- 6 files changed, 7 insertions(+), 7 deletions(-) diff --git a/cpu/lpc2387/mci/lpc2387-mci.c b/cpu/lpc2387/mci/lpc2387-mci.c index b04aa3c341..0a83f75e3f 100644 --- a/cpu/lpc2387/mci/lpc2387-mci.c +++ b/cpu/lpc2387/mci/lpc2387-mci.c @@ -417,7 +417,7 @@ static int send_cmd(unsigned int idx, unsigned long arg, unsigned int rt, unsign //Timer[1] = 100; uint32_t timerstart = hwtimer_now(); - for (;;) { /* Wait for end of the cmd/resp transaction */ + while (1) { /* Wait for end of the cmd/resp transaction */ //if (!Timer[1]) return 0; if (hwtimer_now() - timerstart > 10000) { diff --git a/examples/rpl_udp/udp.c b/examples/rpl_udp/udp.c index 0515faebb7..cffa726c0c 100644 --- a/examples/rpl_udp/udp.c +++ b/examples/rpl_udp/udp.c @@ -68,7 +68,7 @@ void init_udp_server(void) destiny_socket_close(sock); } - for (;;) { + while (1) { recsize = destiny_socket_recvfrom(sock, (void *)buffer_main, UDP_BUFFER_SIZE, 0, &sa, &fromlen); diff --git a/sys/crypto/aes/aes.c b/sys/crypto/aes/aes.c index c7aa8a2d3d..fdb5c0e7e9 100644 --- a/sys/crypto/aes/aes.c +++ b/sys/crypto/aes/aes.c @@ -1104,7 +1104,7 @@ int aes_encrypt(cipher_context_t *context, uint8_t *plainBlock, */ r = key->rounds >> 1; - for (;;) { + while (1) { t0 = Te0[(s0 >> 24) ] ^ Te1[(s1 >> 16) & 0xff] ^ @@ -1365,7 +1365,7 @@ int aes_decrypt(cipher_context_t *context, uint8_t *cipherBlock, */ r = key->rounds >> 1; - for (;;) { + while (1) { t0 = Td0[(s0 >> 24) ] ^ Td1[(s3 >> 16) & 0xff] ^ diff --git a/sys/net/ccn_lite/ccnl-core.c b/sys/net/ccn_lite/ccnl-core.c index 7f9ee47f17..16ebfbf0b8 100644 --- a/sys/net/ccn_lite/ccnl-core.c +++ b/sys/net/ccn_lite/ccnl-core.c @@ -243,7 +243,7 @@ ccnl_extract_prefix_nonce_ppkd(unsigned char **data, int *datalen, int *scope, if (typ == CCN_TT_DTAG) { if (num == CCN_DTAG_NAME) { - for (;;) { + while (1) { if (dehead(data, datalen, &num, &typ) != 0) { goto Bail; } diff --git a/sys/net/ccn_lite/ccnl-ext-mgmt.c b/sys/net/ccn_lite/ccnl-ext-mgmt.c index ac088c295d..24dc69d012 100644 --- a/sys/net/ccn_lite/ccnl-ext-mgmt.c +++ b/sys/net/ccn_lite/ccnl-ext-mgmt.c @@ -430,7 +430,7 @@ ccnl_mgmt_prefixreg(struct ccnl_relay_s *ccnl, struct ccnl_buf_s *orig, } if (typ == CCN_TT_DTAG && num == CCN_DTAG_NAME) { - for (;;) { + while (1) { if (dehead(&buf, &buflen, &num, &typ) != 0) { goto Bail; } diff --git a/sys/semaphore/semaphore.c b/sys/semaphore/semaphore.c index 9cafb2fbeb..9555a89b06 100644 --- a/sys/semaphore/semaphore.c +++ b/sys/semaphore/semaphore.c @@ -95,7 +95,7 @@ static void sem_thread_blocked(sem_t *sem) int sem_wait(sem_t *sem) { int old_state = disableIRQ(); - for (;;) { + while (1) { unsigned value = sem->value; if (value == 0) { sem_thread_blocked(sem); -- GitLab