Merge pull request #72 from hholzgra/hartmut-warnings-2nd

"Hartmut warnings 2nd" merged.
This commit is contained in:
markus456
2015-02-15 20:26:09 +02:00
9 changed files with 23 additions and 17 deletions

View File

@ -1039,6 +1039,7 @@ int main(int argc, char **argv)
int l;
int i;
int n;
intptr_t thread_id;
int n_threads; /*< number of epoll listener threads */
int n_services;
int eno = 0; /*< local variable for errno */
@ -1788,9 +1789,9 @@ int main(int argc, char **argv)
/*<
* Start server threads.
*/
for (n = 0; n < n_threads - 1; n++)
for (thread_id = 0; thread_id < n_threads - 1; thread_id++)
{
threads[n] = thread_start(poll_waitevents, (void *)(n + 1));
threads[thread_id] = thread_start(poll_waitevents, (void *)(thread_id + 1));
}
LOGIF(LM, (skygw_log_write(LOGFILE_MESSAGE,
"MaxScale started with %d server threads.",
@ -1803,9 +1804,9 @@ int main(int argc, char **argv)
/*<
* Wait server threads' completion.
*/
for (n = 0; n < n_threads - 1; n++)
for (thread_id = 0; thread_id < n_threads - 1; thread_id++)
{
thread_wait(threads[n]);
thread_wait(threads[thread_id]);
}
/*<
* Wait the flush thread.

View File

@ -30,7 +30,7 @@
#include <stdio.h>
#include <secrets.h>
main(int argc, char **argv)
int main(int argc, char **argv)
{
if (argc != 2)
{

View File

@ -28,10 +28,12 @@
* @endverbatim
*/
#include <memlog.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
static MEMLOG *memlogs = NULL;
static SPINLOCK *memlock = SPINLOCK_INIT;
static SPINLOCK memlock = SPINLOCK_INIT;
/**
* Create a new instance of a memory logger.

View File

@ -237,7 +237,7 @@ char *
modutil_get_SQL(GWBUF *buf)
{
unsigned int len, length;
unsigned char *ptr, *dptr, *rval = NULL;
char *ptr, *dptr, *rval = NULL;
if (!modutil_is_SQL(buf))
return rval;
@ -671,4 +671,4 @@ static void modutil_reply_routing_error(
/** Create an incoming event for backend DCB */
poll_add_epollin_event_to_dcb(backend_dcb, buf);
return;
}
}

View File

@ -438,7 +438,7 @@ poll_waitevents(void *arg)
{
struct epoll_event events[MAX_EVENTS];
int i, nfds, timeout_bias = 1;
int thread_id = (int)arg;
intptr_t thread_id = (intptr_t)arg;
DCB *zombies = NULL;
int poll_spins = 0;

View File

@ -488,8 +488,11 @@ char *ptr;
}
static int
cmp_topn(TOPNQ **a, TOPNQ **b)
cmp_topn(const void *va, const void *vb)
{
TOPNQ **a = (TOPNQ **)va;
TOPNQ **b = (TOPNQ **)vb;
if ((*b)->duration.tv_sec == (*a)->duration.tv_sec)
return (*b)->duration.tv_usec - (*a)->duration.tv_usec;
return (*b)->duration.tv_sec - (*a)->duration.tv_sec;