Jelajahi Sumber

Autoformat *.inl

bel 10 tahun lalu
induk
melakukan
10372ce328
3 mengubah file dengan 34 tambahan dan 19 penghapusan
  1. 3 3
      src/main.c
  2. 11 7
      src/md5.inl
  3. 20 9
      src/timer.inl

+ 3 - 3
src/main.c

@@ -151,7 +151,7 @@ static void die(const char *fmt, ...)
 }
 
 #ifdef WIN32
-static int MakeConsole();
+static int MakeConsole(void);
 #endif
 
 static void show_server_name(void)
@@ -1115,7 +1115,7 @@ static BOOL CALLBACK InputDlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lP)
 	return FALSE;
 }
 
-void suggest_passwd(char *passwd)
+static void suggest_passwd(char *passwd)
 {
 	unsigned u;
 	char *p;
@@ -1953,7 +1953,7 @@ WindowProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
 	return DefWindowProc(hWnd, msg, wParam, lParam);
 }
 
-static int MakeConsole()
+static int MakeConsole(void)
 {
 	DWORD err;
 	int ok = (GetConsoleWindow() != NULL);

+ 11 - 7
src/md5.inl

@@ -65,8 +65,8 @@ extern "C" {
 MD5_STATIC void md5_init(md5_state_t *pms);
 
 /* Append a string to the message. */
-MD5_STATIC void md5_append(md5_state_t *pms, const md5_byte_t *data,
-                           size_t nbytes);
+MD5_STATIC void
+md5_append(md5_state_t *pms, const md5_byte_t *data, size_t nbytes);
 
 /* Finish the message and return the digest. */
 MD5_STATIC void md5_finish(md5_state_t *pms, md5_byte_t digest[16]);
@@ -207,7 +207,8 @@ MD5_STATIC void md5_finish(md5_state_t *pms, md5_byte_t digest[16]);
 #define T63 (0x2ad7d2bb)
 #define T64 /* 0xeb86d391 */ (T_MASK ^ 0x14792c6e)
 
-static void md5_process(md5_state_t *pms, const md5_byte_t *data /*[64]*/) {
+static void md5_process(md5_state_t *pms, const md5_byte_t *data /*[64]*/)
+{
 	md5_word_t a = pms->abcd[0], b = pms->abcd[1], c = pms->abcd[2],
 	           d = pms->abcd[3];
 	md5_word_t t;
@@ -394,7 +395,8 @@ static void md5_process(md5_state_t *pms, const md5_byte_t *data /*[64]*/) {
 	pms->abcd[3] += d;
 }
 
-MD5_STATIC void md5_init(md5_state_t *pms) {
+MD5_STATIC void md5_init(md5_state_t *pms)
+{
 	pms->count[0] = pms->count[1] = 0;
 	pms->abcd[0] = 0x67452301;
 	pms->abcd[1] = /*0xefcdab89*/ T_MASK ^ 0x10325476;
@@ -402,8 +404,9 @@ MD5_STATIC void md5_init(md5_state_t *pms) {
 	pms->abcd[3] = 0x10325476;
 }
 
-MD5_STATIC void md5_append(md5_state_t *pms, const md5_byte_t *data,
-                           size_t nbytes) {
+MD5_STATIC void
+md5_append(md5_state_t *pms, const md5_byte_t *data, size_t nbytes)
+{
 	const md5_byte_t *p = data;
 	size_t left = nbytes;
 	size_t offset = (pms->count[0] >> 3) & 63;
@@ -439,7 +442,8 @@ MD5_STATIC void md5_append(md5_state_t *pms, const md5_byte_t *data,
 		memcpy(pms->buf, p, left);
 }
 
-MD5_STATIC void md5_finish(md5_state_t *pms, md5_byte_t digest[16]) {
+MD5_STATIC void md5_finish(md5_state_t *pms, md5_byte_t digest[16])
+{
 	static const md5_byte_t pad[64] = {
 	    0x80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
 	    0,    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,

+ 20 - 9
src/timer.inl

@@ -19,8 +19,13 @@ struct ttimers {
 	unsigned timer_count;             /* Current size of timer list */
 };
 
-static int timer_add(struct mg_context *ctx, double next_time, double period,
-                     int is_relative, taction action, void *arg) {
+static int timer_add(struct mg_context *ctx,
+                     double next_time,
+                     double period,
+                     int is_relative,
+                     taction action,
+                     void *arg)
+{
 	unsigned u, v;
 	int error = 0;
 	struct timespec now;
@@ -57,7 +62,8 @@ static int timer_add(struct mg_context *ctx, double next_time, double period,
 	return error;
 }
 
-static void timer_thread_run(void *thread_func_param) {
+static void timer_thread_run(void *thread_func_param)
+{
 	struct mg_context *ctx = (struct mg_context *)thread_func_param;
 	struct timespec now;
 	double d;
@@ -67,8 +73,9 @@ static void timer_thread_run(void *thread_func_param) {
 
 #if defined(HAVE_CLOCK_NANOSLEEP) /* Linux with librt */
 	/* TODO */
-	while (clock_nanosleep(CLOCK_MONOTONIC, TIMER_ABSTIME, &request,
-	                       &request) == EINTR) { /*nop*/
+	while (
+	    clock_nanosleep(CLOCK_MONOTONIC, TIMER_ABSTIME, &request, &request) ==
+	    EINTR) { /*nop*/
 		;
 	}
 #else
@@ -99,18 +106,21 @@ static void timer_thread_run(void *thread_func_param) {
 }
 
 #ifdef _WIN32
-static unsigned __stdcall timer_thread(void *thread_func_param) {
+static unsigned __stdcall timer_thread(void *thread_func_param)
+{
 	timer_thread_run(thread_func_param);
 	return 0;
 }
 #else
-static void *timer_thread(void *thread_func_param) {
+static void *timer_thread(void *thread_func_param)
+{
 	timer_thread_run(thread_func_param);
 	return NULL;
 }
 #endif /* _WIN32 */
 
-static int timers_init(struct mg_context *ctx) {
+static int timers_init(struct mg_context *ctx)
+{
 	ctx->timers = (struct ttimers *)mg_calloc(sizeof(struct ttimers), 1);
 	(void)pthread_mutex_init(&ctx->timers->mutex, NULL);
 
@@ -120,7 +130,8 @@ static int timers_init(struct mg_context *ctx) {
 	return 0;
 }
 
-static void timers_exit(struct mg_context *ctx) {
+static void timers_exit(struct mg_context *ctx)
+{
 	if (ctx->timers) {
 		(void)pthread_mutex_destroy(&ctx->timers->mutex);
 		mg_free(ctx->timers);