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 fccae75f5221a0307cb52a5e8d7aa6cf820ec6df (commit) from 8caa76a32fdad0cc36b1a4ac6038b205f17b504e (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/fccae75f5221a0307cb52a5e8d7aa6cf820ec...
commit fccae75f5221a0307cb52a5e8d7aa6cf820ec6df Author: Cyril Hrubis metan@ucw.cz Date: Sat Oct 13 20:23:37 2012 +0200
core: Remove unused GP_Counter.
diff --git a/include/core/GP_Core.h b/include/core/GP_Core.h index cd5555d..d10152f 100644 --- a/include/core/GP_Core.h +++ b/include/core/GP_Core.h @@ -71,9 +71,6 @@ /* Threads utils */ #include "core/GP_Threads.h"
-/* Debug counters */ -#include "core/GP_Counter.h" - /* Mix Pixel */ #include "core/GP_MixPixels.h"
diff --git a/include/core/GP_Counter.h b/include/core/GP_Counter.h deleted file mode 100644 index 0429df9..0000000 --- a/include/core/GP_Counter.h +++ /dev/null @@ -1,121 +0,0 @@ -/***************************************************************************** - * This file is part of gfxprim library. * - * * - * Gfxprim is free software; you can redistribute it and/or * - * modify it under the terms of the GNU Lesser General Public * - * License as published by the Free Software Foundation; either * - * version 2.1 of the License, or (at your option) any later version. * - * * - * Gfxprim is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * - * Lesser General Public License for more details. * - * * - * You should have received a copy of the GNU Lesser General Public * - * License along with gfxprim; if not, write to the Free Software * - * Foundation, Inc., 51 Franklin Street, Fifth Floor, * - * Boston, MA 02110-1301 USA * - * * - * Copyright (C) 2011 Tomas Gavenciak gavento@ucw.cz * - * Copyright (C) 2012 Cyril Hrubis metan@ucw.cz * - * * - *****************************************************************************/ - -#ifndef CORE_GP_COUNTER_H -#define CORE_GP_COUNTER_H - -/* - * Simple global named 64-bit counters. - * - * Intended for accounting of expensive operations ("quantitative warnings"). - * All operations accept NULL as GP_Counter. - * - * 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 - -/* - * 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)++; -#endif /* GP_IMPLEMENT_COUNTERS */ -} - -/* - * 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; - (*counter) += delta; -#endif /* GP_IMPLEMENT_COUNTERS */ -} - -/* - * Set counter to given value. - */ -static inline void GP_SetCounter(GP_Counter counter, GP_Counter_t value) -{ -#ifdef GP_IMPLEMENT_COUNTERS - if (!counter) - return; - (*counter) = value; -#endif /* GP_IMPLEMENT_COUNTERS */ -} - -/* - * Return counter value - */ -static inline GP_Counter_t GP_CounterVal(GP_Counter counter) -{ -#ifdef GP_IMPLEMENT_COUNTERS - if (!counter) - return 0; - return *counter; -#else /* GP_IMPLEMENT_COUNTERS */ - return 0; -#endif /* GP_IMPLEMENT_COUNTERS */ -} - -/* - * Pretty-printing of all counters and their values to f - * Includes info about counter-list overflow - */ -#include <stdio.h> -void GP_PrintCounters(FILE *f); - -/* - * Lookup a counter by name, possibly creating a new one. - * - * May return NULL if no space is left in the counter list. - * The returned value is not unallocated in any way. - * - * 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 /* CORE_GP_COUNTER_H */ diff --git a/libs/core/GP_Counter.c b/libs/core/GP_Counter.c deleted file mode 100644 index 7ba619e..0000000 --- a/libs/core/GP_Counter.c +++ /dev/null @@ -1,109 +0,0 @@ -/***************************************************************************** - * This file is part of gfxprim library. * - * * - * Gfxprim is free software; you can redistribute it and/or * - * modify it under the terms of the GNU Lesser General Public * - * License as published by the Free Software Foundation; either * - * version 2.1 of the License, or (at your option) any later version. * - * * - * Gfxprim is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * - * Lesser General Public License for more details. * - * * - * You should have received a copy of the GNU Lesser General Public * - * License along with gfxprim; if not, write to the Free Software * - * Foundation, Inc., 51 Franklin Street, Fifth Floor, * - * 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 "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]; -static int GP_used_counters = 0; -static struct GP_CounterRecord GP_counter_list[GP_COUNTER_MAX]; -static GP_Counter_t GP_counter_list_overflow = 0; - -#endif /* GP_IMPLEMENT_COUNTERS */ - -void GP_PrintCounters(FILE *f) -{ -#ifdef GP_IMPLEMENT_COUNTERS - int i; - GP_CHECK(f != NULL); - if (GP_used_counters == 0) - fprintf(f, "[ no counters defined ]n"); - for (i = 0; i < GP_used_counters; i++) - 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(f, "[ unable to allocate new counter %llu times ]n", - (long long unsigned int)GP_counter_list_overflow); -#endif /* GP_IMPLEMENT_COUNTERS */ -} - -GP_Counter GP_GetCounter(const char *name) -{ -#ifdef GP_IMPLEMENT_COUNTERS - int l = 0; - int r = GP_used_counters; - - 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) { - 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) - return GP_counter_list[med].counter; - if (cmp < 0) - l = med + 1; - else - r = med; - } - GP_CHECK(l == r); - if ((l < GP_used_counters) && (strcmp(GP_counter_list[l].name, name) == 0)) - return GP_counter_list[l].counter; - - /* Add a new counter */ - if (GP_used_counters >= GP_COUNTER_MAX) { - GP_counter_list_overflow++; - return NULL; - } - - /* Move the counter records up and initialize a new one */ - memmove(GP_counter_list + l + 1, GP_counter_list + l, - sizeof(struct GP_CounterRecord) * GP_used_counters - l); - strcpy(GP_counter_list[l].name, name); - GP_counter_list[l].counter = GP_counters + GP_used_counters; - - GP_used_counters++; - return GP_counter_list[l].counter; -#else /* GP_IMPLEMENT_COUNTERS */ - return NULL; -#endif /* GP_IMPLEMENT_COUNTERS */ -} diff --git a/pylib/gfxprim/core/core.i b/pylib/gfxprim/core/core.i index 67777dd..6ddfc29 100644 --- a/pylib/gfxprim/core/core.i +++ b/pylib/gfxprim/core/core.i @@ -9,14 +9,11 @@ * Basic types and common methods */
-ERROR_ON_NULL(GP_GetCounter); - %include "GP_Common.h" %include "GP_Core.h" %include "GP_Debug.h" %include "GP_Types.h" %include "GP_Transform.h" -%include "GP_Counter.h" %include "GP_GetSetBits.h" %include "GP_Transform.h" %include "GP_ProgressCallback.h" diff --git a/tests/core_old/GP_Counter.test.c b/tests/core_old/GP_Counter.test.c deleted file mode 100644 index 6bd9ab7..0000000 --- a/tests/core_old/GP_Counter.test.c +++ /dev/null @@ -1,81 +0,0 @@ -/***************************************************************************** - * This file is part of gfxprim library. * - * * - * Gfxprim is free software; you can redistribute it and/or * - * modify it under the terms of the GNU Lesser General Public * - * License as published by the Free Software Foundation; either * - * version 2.1 of the License, or (at your option) any later version. * - * * - * Gfxprim is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * - * Lesser General Public License for more details. * - * * - * You should have received a copy of the GNU Lesser General Public * - * License along with gfxprim; if not, write to the Free Software * - * Foundation, Inc., 51 Franklin Street, Fifth Floor, * - * Boston, MA 02110-1301 USA * - * * - * Copyright (C) 2011 Tomas Gavenciak gavento@ucw.cz * - * * - *****************************************************************************/ - -#include <string.h> -#include <stdio.h> - -#include "GP_Tests.h" -#include "GP_Counter.h" - -GP_SUITE(GP_Counter) - -GP_TEST(Smoke) -{ - fail_unless(GP_CounterVal(NULL) == 0); - GP_IncCounter(NULL); - GP_AddCounter(NULL, -10); - fail_unless(GP_GetCounter("") != NULL); - - GP_IncCounter(GP_GetCounter("a")); - fail_unless(GP_CounterVal(GP_GetCounter("a")) == 1); - - GP_PrintCounters(fopen("/dev/null","wt")); -} -END_TEST - -GP_TEST(Allocation) -{ - /* random-like operations with counters, - * should test reasonably many combinations */ - GP_SetCounter(GP_GetCounter("a"), 11); - GP_AddCounter(GP_GetCounter("e"), -42); - GP_Counter b = GP_GetCounter("b"); - GP_IncCounter(GP_GetCounter("a")); - GP_GetCounter("d"); - GP_AddCounter(GP_GetCounter("c"), 21); - GP_IncCounter(GP_GetCounter("b")); - GP_AddCounter(GP_GetCounter("b"), -8); - GP_IncCounter(b); - GP_SetCounter(GP_GetCounter("f"), 91); - GP_SetCounter(GP_GetCounter("f"), -1); - - fail_unless(GP_CounterVal(GP_GetCounter("a")) == 12); - fail_unless(GP_CounterVal(GP_GetCounter("b")) == -6); - fail_unless(GP_CounterVal(GP_GetCounter("c")) == 21); - fail_unless(GP_CounterVal(GP_GetCounter("d")) == 0); - fail_unless(GP_CounterVal(GP_GetCounter("e")) == -42); - fail_unless(GP_CounterVal(GP_GetCounter("f")) == -1); -} -END_TEST - -GP_TEST(Overflow) -{ - char buf[8]; - int i; - for (i = 0; i < GP_COUNTER_MAX; i++) { - sprintf(buf, "%d", i); - fail_if(GP_GetCounter(buf) == NULL); - } - fail_unless(GP_GetCounter("next") == NULL); -} -END_TEST -
-----------------------------------------------------------------------
Summary of changes: include/core/GP_Core.h | 3 - include/core/GP_Counter.h | 121 -------------------------------------- libs/core/GP_Counter.c | 109 ---------------------------------- pylib/gfxprim/core/core.i | 3 - tests/core_old/GP_Counter.test.c | 81 ------------------------- 5 files changed, 0 insertions(+), 317 deletions(-) delete mode 100644 include/core/GP_Counter.h delete mode 100644 libs/core/GP_Counter.c delete mode 100644 tests/core_old/GP_Counter.test.c
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.