This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project gfxprim.git.
The branch, master has been updated via 97369ab9d2fc879e4d491f7f0813db4fa191b5e8 (commit) from b02edef9bfce2083f3692ffccd6a3acd750b79da (commit)
Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below.
- Log ----------------------------------------------------------------- http://repo.or.cz/w/gfxprim.git/commit/97369ab9d2fc879e4d491f7f0813db4fa191b...
commit 97369ab9d2fc879e4d491f7f0813db4fa191b5e8 Author: Cyril Hrubis metan@ucw.cz Date: Sat Jan 14 18:53:47 2012 +0100
core: Fix GP_Counter warnings.
diff --git a/include/core/GP_Counter.h b/include/core/GP_Counter.h index f9e501e..21eaccf 100644 --- a/include/core/GP_Counter.h +++ b/include/core/GP_Counter.h @@ -17,11 +17,12 @@ * Boston, MA 02110-1301 USA * * * * Copyright (C) 2011 Tomas Gavenciak gavento@ucw.cz * + * Copyright (C) 2012 Cyril Hrubis metan@ucw.cz * * * *****************************************************************************/
-#ifndef GP_COUNTER_H -#define GP_COUNTER_H +#ifndef CORE_GP_COUNTER_H +#define CORE_GP_COUNTER_H
/* * Simple global named 64-bit counters. @@ -32,14 +33,12 @@ * If GP_IMPLEMENT_COUNTERS is undefined, all operations are NOP and * no memory is allocated. */ - #define GP_IMPLEMENT_COUNTERS
/* * Maximum length of counter name, * maximum number of counters (~40 bytes each) */ - #define GP_COUNTER_NAME_LEN 24 #define GP_COUNTER_MAX 256
@@ -47,19 +46,18 @@ * Basic types. * Only use GP_Counter in your programs. */ - typedef int64_t GP_Counter_t; typedef GP_Counter_t *GP_Counter;
/* * Increase a counter by 1. */ - static inline void GP_IncCounter(GP_Counter counter) { #ifdef GP_IMPLEMENT_COUNTERS - if (!counter) return; - (*counter) ++; + if (!counter) + return; + (*counter)++; #endif /* GP_IMPLEMENT_COUNTERS */ }
@@ -67,11 +65,11 @@ static inline void GP_IncCounter(GP_Counter counter) * Increase a counter by delta (may be negative). * No checks for underflow. */ - static inline void GP_AddCounter(GP_Counter counter, GP_Counter_t delta) { #ifdef GP_IMPLEMENT_COUNTERS - if (!counter) return; + if (!counter) + return; (*counter) += delta; #endif /* GP_IMPLEMENT_COUNTERS */ } @@ -79,11 +77,11 @@ static inline void GP_AddCounter(GP_Counter counter, GP_Counter_t delta) /* * Set counter to given value. */ - static inline void GP_SetCounter(GP_Counter counter, GP_Counter_t value) { #ifdef GP_IMPLEMENT_COUNTERS - if (!counter) return; + if (!counter) + return; (*counter) = value; #endif /* GP_IMPLEMENT_COUNTERS */ } @@ -91,11 +89,11 @@ static inline void GP_SetCounter(GP_Counter counter, GP_Counter_t value) /* * Return counter value */ - -inline GP_Counter_t GP_CounterVal(GP_Counter counter) +static inline GP_Counter_t GP_CounterVal(GP_Counter counter) { #ifdef GP_IMPLEMENT_COUNTERS - if (!counter) return 0; + if (!counter) + return 0; return *counter; #else /* GP_IMPLEMENT_COUNTERS */ return 0; @@ -106,9 +104,8 @@ inline GP_Counter_t GP_CounterVal(GP_Counter counter) * Pretty-printing of all counters and their values to f * Includes info about counter-list overflow */ - -struct FILE; -void GP_PrintCounters(struct FILE *f); +#include <stdio.h> +void GP_PrintCounters(FILE *f);
/* * Lookup a counter by name, possibly creating a new one. @@ -119,7 +116,6 @@ void GP_PrintCounters(struct FILE *f); * NOTE: Current implementation has very slow adds (O(current_counters)), * but the lookup is reasonably fast (bisection) */ - GP_Counter GP_GetCounter(const char *name);
-#endif /* GP_COUNTER_H */ +#endif /* CORE_GP_COUNTER_H */ diff --git a/libs/core/GP_Counter.c b/libs/core/GP_Counter.c index a7809d3..7ba619e 100644 --- a/libs/core/GP_Counter.c +++ b/libs/core/GP_Counter.c @@ -17,28 +17,25 @@ * Boston, MA 02110-1301 USA * * * * Copyright (C) 2011 Tomas Gavenciak gavento@ucw.cz * + * Copyright (C) 2012 Cyril Hrubis metan@ucw.cz * * * *****************************************************************************/
#include <string.h> -#include <stdio.h> #include "GP_Common.h" #include "GP_Counter.h"
/* * Internal struct used in counter list */ - struct GP_CounterRecord { char name[GP_COUNTER_NAME_LEN]; GP_Counter counter; };
- /* * variables local to module (static) */ - #ifdef GP_IMPLEMENT_COUNTERS
static GP_Counter_t GP_counters[GP_COUNTER_MAX]; @@ -48,19 +45,20 @@ static GP_Counter_t GP_counter_list_overflow = 0;
#endif /* GP_IMPLEMENT_COUNTERS */
-void GP_PrintCounters(struct FILE *f) +void GP_PrintCounters(FILE *f) { #ifdef GP_IMPLEMENT_COUNTERS int i; GP_CHECK(f != NULL); if (GP_used_counters == 0) - fprintf((FILE *) f, "[ no counters defined ]n"); + fprintf(f, "[ no counters defined ]n"); for (i = 0; i < GP_used_counters; i++) - fprintf((FILE *) f, "%*s : %lldn", -GP_COUNTER_NAME_LEN, - GP_counter_list[i].name, *(GP_counter_list[i].counter)); + fprintf(f, "%*s : %llun", -GP_COUNTER_NAME_LEN, + GP_counter_list[i].name, + (long long unsigned int)*(GP_counter_list[i].counter)); if (GP_counter_list_overflow > 0) - fprintf((FILE *) f, "[ unable to allocate new counter %lld times ]n", - GP_counter_list_overflow); + fprintf(f, "[ unable to allocate new counter %llu times ]n", + (long long unsigned int)GP_counter_list_overflow); #endif /* GP_IMPLEMENT_COUNTERS */ }
@@ -73,9 +71,11 @@ GP_Counter GP_GetCounter(const char *name) GP_CHECK(name != NULL); GP_CHECK(strlen(name) + 1 <= GP_COUNTER_NAME_LEN);
- /* Bisect GP_counter_list to find either the counter or a place for it - * interval [l, r) (not incl. r) */ - while(r > l) { + /* + * Bisect GP_counter_list to find either the counter or a place for it + * interval [l, r) (not incl. r) + */ + while (r > l) { int med = (r + l) / 2; /* Here never equal to r, might be l */ int cmp = strcmp(GP_counter_list[med].name, name); if (cmp == 0) @@ -91,7 +91,7 @@ GP_Counter GP_GetCounter(const char *name)
/* Add a new counter */ if (GP_used_counters >= GP_COUNTER_MAX) { - GP_counter_list_overflow ++; + GP_counter_list_overflow++; return NULL; }
@@ -101,7 +101,7 @@ GP_Counter GP_GetCounter(const char *name) strcpy(GP_counter_list[l].name, name); GP_counter_list[l].counter = GP_counters + GP_used_counters; - GP_used_counters ++; + GP_used_counters++; return GP_counter_list[l].counter; #else /* GP_IMPLEMENT_COUNTERS */ return NULL;
-----------------------------------------------------------------------
Summary of changes: include/core/GP_Counter.h | 36 ++++++++++++++++-------------------- libs/core/GP_Counter.c | 30 +++++++++++++++--------------- 2 files changed, 31 insertions(+), 35 deletions(-)
repo.or.cz automatic notification. Contact project admin jiri.bluebear.dluhos@gmail.com if you want to unsubscribe, or site admin admin@repo.or.cz if you receive no reply.