Author: abroekhuis
Date: Thu Jun 16 13:08:52 2011
New Revision: 1136423
URL: http://svn.apache.org/viewvc?rev=1136423&view=rev
Log:
Applied patch from CELIX-6
Added:
incubator/celix/trunk/framework/private/include/celixbool.h (with props)
Modified:
incubator/celix/trunk/.cproject
incubator/celix/trunk/CMakeLists.txt
incubator/celix/trunk/framework/CMakeLists.txt
incubator/celix/trunk/framework/private/include/version_range.h
incubator/celix/trunk/framework/private/src/framework.c
incubator/celix/trunk/framework/private/src/manifest.c
incubator/celix/trunk/utils/CMakeLists.txt
incubator/celix/trunk/utils/private/src/array_list.c
incubator/celix/trunk/utils/private/src/hash_map.c
incubator/celix/trunk/utils/private/src/linked_list_iterator.c
incubator/celix/trunk/utils/private/src/linkedlist.c
incubator/celix/trunk/utils/public/include/array_list.h
incubator/celix/trunk/utils/public/include/hash_map.h
incubator/celix/trunk/utils/public/include/linked_list_iterator.h
incubator/celix/trunk/utils/public/include/linkedlist.h
incubator/celix/trunk/whiteboard/tracker/activator.c
incubator/celix/trunk/whiteboard/tracker_depman/dependency_activator.c
incubator/celix/trunk/whiteboard/tracker_depman/tracker.c
Modified: incubator/celix/trunk/.cproject
URL:
http://svn.apache.org/viewvc/incubator/celix/trunk/.cproject?rev=1136423&r1=1136422&r2=1136423&view=diff
==============================================================================
--- incubator/celix/trunk/.cproject (original)
+++ incubator/celix/trunk/.cproject Thu Jun 16 13:08:52 2011
@@ -55,174 +55,10 @@
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
<project id="c-osgi.null.931222562" name="c-osgi"/>
</storageModule>
- <storageModule moduleId="scannerConfiguration">
- <autodiscovery enabled="true" problemReportingEnabled="true"
selectedProfileId="org.eclipse.cdt.make.core.GCCStandardMakePerProjectProfile"/>
- <profile
id="org.eclipse.cdt.make.core.GCCStandardMakePerProjectProfile">
- <buildOutputProvider>
- <openAction enabled="true" filePath=""/>
- <parser enabled="true"/>
- </buildOutputProvider>
- <scannerInfoProvider id="specsFile">
- <runAction arguments="-E -P -v -dD
${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
- <parser enabled="true"/>
- </scannerInfoProvider>
- </profile>
- <profile
id="org.eclipse.cdt.make.core.GCCStandardMakePerFileProfile">
- <buildOutputProvider>
- <openAction enabled="true" filePath=""/>
- <parser enabled="true"/>
- </buildOutputProvider>
- <scannerInfoProvider id="makefileGenerator">
- <runAction arguments="-f
${project_name}_scd.mk" command="make" useDefault="true"/>
- <parser enabled="true"/>
- </scannerInfoProvider>
- </profile>
- <profile
id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfile">
- <buildOutputProvider>
- <openAction enabled="true" filePath=""/>
- <parser enabled="true"/>
- </buildOutputProvider>
- <scannerInfoProvider id="specsFile">
- <runAction arguments="-E -P -v -dD
${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
- <parser enabled="true"/>
- </scannerInfoProvider>
- </profile>
- <profile
id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileCPP">
- <buildOutputProvider>
- <openAction enabled="true" filePath=""/>
- <parser enabled="true"/>
- </buildOutputProvider>
- <scannerInfoProvider id="specsFile">
- <runAction arguments="-E -P -v -dD
${plugin_state_location}/specs.cpp" command="g++" useDefault="true"/>
- <parser enabled="true"/>
- </scannerInfoProvider>
- </profile>
- <profile
id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileC">
- <buildOutputProvider>
- <openAction enabled="true" filePath=""/>
- <parser enabled="true"/>
- </buildOutputProvider>
- <scannerInfoProvider id="specsFile">
- <runAction arguments="-E -P -v -dD
${plugin_state_location}/specs.c" command="gcc" useDefault="true"/>
- <parser enabled="true"/>
- </scannerInfoProvider>
- </profile>
- <profile
id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfile">
- <buildOutputProvider>
- <openAction enabled="true" filePath=""/>
- <parser enabled="true"/>
- </buildOutputProvider>
- <scannerInfoProvider id="specsFile">
- <runAction arguments="-c 'gcc -E -P -v -dD
"${plugin_state_location}/${specs_file}"'" command="sh"
useDefault="true"/>
- <parser enabled="true"/>
- </scannerInfoProvider>
- </profile>
- <profile
id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileCPP">
- <buildOutputProvider>
- <openAction enabled="true" filePath=""/>
- <parser enabled="true"/>
- </buildOutputProvider>
- <scannerInfoProvider id="specsFile">
- <runAction arguments="-c 'g++ -E -P -v -dD
"${plugin_state_location}/specs.cpp"'" command="sh"
useDefault="true"/>
- <parser enabled="true"/>
- </scannerInfoProvider>
- </profile>
- <profile
id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileC">
- <buildOutputProvider>
- <openAction enabled="true" filePath=""/>
- <parser enabled="true"/>
- </buildOutputProvider>
- <scannerInfoProvider id="specsFile">
- <runAction arguments="-c 'gcc -E -P -v -dD
"${plugin_state_location}/specs.c"'" command="sh" useDefault="true"/>
- <parser enabled="true"/>
- </scannerInfoProvider>
- </profile>
- <scannerConfigBuildInfo
instanceId="cdt.managedbuild.toolchain.gnu.macosx.base.1808592147;cdt.managedbuild.toolchain.gnu.macosx.base.1808592147.1856684693;cdt.managedbuild.tool.gnu.c.compiler.macosx.base.387685994;cdt.managedbuild.tool.gnu.c.compiler.input.1627566234">
- <autodiscovery enabled="true"
problemReportingEnabled="true"
selectedProfileId="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileC"/>
- <profile
id="org.eclipse.cdt.make.core.GCCStandardMakePerProjectProfile">
- <buildOutputProvider>
- <openAction enabled="true" filePath=""/>
- <parser enabled="true"/>
- </buildOutputProvider>
- <scannerInfoProvider id="specsFile">
- <runAction arguments="-E -P -v -dD
${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
- <parser enabled="true"/>
- </scannerInfoProvider>
- </profile>
- <profile
id="org.eclipse.cdt.make.core.GCCStandardMakePerFileProfile">
- <buildOutputProvider>
- <openAction enabled="true" filePath=""/>
- <parser enabled="true"/>
- </buildOutputProvider>
- <scannerInfoProvider id="makefileGenerator">
- <runAction arguments="-f
${project_name}_scd.mk" command="make" useDefault="true"/>
- <parser enabled="true"/>
- </scannerInfoProvider>
- </profile>
- <profile
id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfile">
- <buildOutputProvider>
- <openAction enabled="true" filePath=""/>
- <parser enabled="true"/>
- </buildOutputProvider>
- <scannerInfoProvider id="specsFile">
- <runAction arguments="-E -P -v -dD
${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
- <parser enabled="true"/>
- </scannerInfoProvider>
- </profile>
- <profile
id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileCPP">
- <buildOutputProvider>
- <openAction enabled="true" filePath=""/>
- <parser enabled="true"/>
- </buildOutputProvider>
- <scannerInfoProvider id="specsFile">
- <runAction arguments="-E -P -v -dD
${plugin_state_location}/specs.cpp" command="g++" useDefault="true"/>
- <parser enabled="true"/>
- </scannerInfoProvider>
- </profile>
- <profile
id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileC">
- <buildOutputProvider>
- <openAction enabled="true" filePath=""/>
- <parser enabled="true"/>
- </buildOutputProvider>
- <scannerInfoProvider id="specsFile">
- <runAction arguments="-E -P -v -dD
${plugin_state_location}/specs.c" command="gcc" useDefault="true"/>
- <parser enabled="true"/>
- </scannerInfoProvider>
- </profile>
- <profile
id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfile">
- <buildOutputProvider>
- <openAction enabled="true" filePath=""/>
- <parser enabled="true"/>
- </buildOutputProvider>
- <scannerInfoProvider id="specsFile">
- <runAction arguments="-c 'gcc -E -P -v
-dD "${plugin_state_location}/${specs_file}"'" command="sh"
useDefault="true"/>
- <parser enabled="true"/>
- </scannerInfoProvider>
- </profile>
- <profile
id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileCPP">
- <buildOutputProvider>
- <openAction enabled="true" filePath=""/>
- <parser enabled="true"/>
- </buildOutputProvider>
- <scannerInfoProvider id="specsFile">
- <runAction arguments="-c 'g++ -E -P -v
-dD "${plugin_state_location}/specs.cpp"'" command="sh"
useDefault="true"/>
- <parser enabled="true"/>
- </scannerInfoProvider>
- </profile>
- <profile
id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileC">
- <buildOutputProvider>
- <openAction enabled="true" filePath=""/>
- <parser enabled="true"/>
- </buildOutputProvider>
- <scannerInfoProvider id="specsFile">
- <runAction arguments="-c 'gcc -E -P -v
-dD "${plugin_state_location}/specs.c"'" command="sh"
useDefault="true"/>
- <parser enabled="true"/>
- </scannerInfoProvider>
- </profile>
- </scannerConfigBuildInfo>
- </storageModule>
<storageModule
moduleId="org.eclipse.cdt.internal.ui.text.commentOwnerProjectMappings"/>
- <storageModule moduleId="refreshScope"/>
+ <storageModule moduleId="refreshScope" versionNumber="1">
+ <resource resourceType="PROJECT" workspacePath="/celix"/>
+ </storageModule>
<storageModule moduleId="org.eclipse.cdt.make.core.buildtargets">
<buildTargets>
<target name="all" path=""
targetID="org.eclipse.cdt.build.MakeTargetBuilder">
@@ -307,4 +143,40 @@
</target>
</buildTargets>
</storageModule>
+ <storageModule moduleId="scannerConfiguration">
+ <autodiscovery enabled="true" problemReportingEnabled="true"
selectedProfileId="org.eclipse.cdt.make.core.GCCStandardMakePerProjectProfile"/>
+ <profile
id="org.eclipse.cdt.make.core.GCCStandardMakePerFileProfile">
+ <buildOutputProvider>
+ <openAction enabled="true" filePath=""/>
+ <parser enabled="true"/>
+ </buildOutputProvider>
+ <scannerInfoProvider id="makefileGenerator">
+ <runAction arguments="-f
${project_name}_scd.mk" command="make" useDefault="true"/>
+ <parser enabled="true"/>
+ </scannerInfoProvider>
+ </profile>
+ <scannerConfigBuildInfo
instanceId="cdt.managedbuild.toolchain.gnu.macosx.base.1808592147;cdt.managedbuild.toolchain.gnu.macosx.base.1808592147.1856684693;cdt.managedbuild.tool.gnu.c.compiler.macosx.base.387685994;cdt.managedbuild.tool.gnu.c.compiler.input.1627566234">
+ <autodiscovery enabled="true"
problemReportingEnabled="true"
selectedProfileId="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileC"/>
+ <profile
id="org.eclipse.cdt.make.core.GCCStandardMakePerFileProfile">
+ <buildOutputProvider>
+ <openAction enabled="true" filePath=""/>
+ <parser enabled="true"/>
+ </buildOutputProvider>
+ <scannerInfoProvider id="makefileGenerator">
+ <runAction arguments="-f
${project_name}_scd.mk" command="make" useDefault="true"/>
+ <parser enabled="true"/>
+ </scannerInfoProvider>
+ </profile>
+ <profile
id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileC">
+ <buildOutputProvider>
+ <openAction enabled="true" filePath=""/>
+ <parser enabled="true"/>
+ </buildOutputProvider>
+ <scannerInfoProvider id="specsFile">
+ <runAction arguments="-E -P -v -dD
${plugin_state_location}/specs.c -std=c99" command="gcc" useDefault="true"/>
+ <parser enabled="true"/>
+ </scannerInfoProvider>
+ </profile>
+ </scannerConfigBuildInfo>
+ </storageModule>
</cproject>
Modified: incubator/celix/trunk/CMakeLists.txt
URL:
http://svn.apache.org/viewvc/incubator/celix/trunk/CMakeLists.txt?rev=1136423&r1=1136422&r2=1136423&view=diff
==============================================================================
--- incubator/celix/trunk/CMakeLists.txt (original)
+++ incubator/celix/trunk/CMakeLists.txt Thu Jun 16 13:08:52 2011
@@ -23,8 +23,7 @@ project (Celix C)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH}
"${CMAKE_SOURCE_DIR}/cmake/modules/")
SET(CMAKE_BUILD_TYPE "Debug")
-SET(CMAKE_C_FLAGS "-std=c99")
-SET(CMAKE_C_FLAGS "-D_GNU_SOURCE")
+SET(CMAKE_C_FLAGS "-D_GNU_SOURCE -std=c99")
SET(CMAKE_INSTALL_COMPONENT "framework")
ADD_CUSTOM_TARGET(install-fw
Modified: incubator/celix/trunk/framework/CMakeLists.txt
URL:
http://svn.apache.org/viewvc/incubator/celix/trunk/framework/CMakeLists.txt?rev=1136423&r1=1136422&r2=1136423&view=diff
==============================================================================
--- incubator/celix/trunk/framework/CMakeLists.txt (original)
+++ incubator/celix/trunk/framework/CMakeLists.txt Thu Jun 16 13:08:52 2011
@@ -42,4 +42,4 @@ include_directories("${PROJECT_SOURCE_DI
add_library(framework SHARED ${SRC})
target_link_libraries(framework utils ${ZLIB_LIBRARY} ${APR_LIBRARY}
${CURL_LIBRARY})
-install(TARGETS framework LIBRARY DESTINATION lib COMPONENT framework)
+install(TARGETS framework LIBRARY DESTINATION lib ARCHIVE DESTINATION lib
COMPONENT framework)
Added: incubator/celix/trunk/framework/private/include/celixbool.h
URL:
http://svn.apache.org/viewvc/incubator/celix/trunk/framework/private/include/celixbool.h?rev=1136423&view=auto
==============================================================================
--- incubator/celix/trunk/framework/private/include/celixbool.h (added)
+++ incubator/celix/trunk/framework/private/include/celixbool.h Thu Jun 16
13:08:52 2011
@@ -0,0 +1,33 @@
+#ifndef CELIXBOOL_H_
+#define CELIXBOOL_H_
+
+
+#if defined(__STDC__)
+# define C89
+# if defined(__STDC_VERSION__)
+# define C90
+# if (__STDC_VERSION__ >= 199409L)
+# define C94
+# endif
+# if (__STDC_VERSION__ >= 199901L)
+# define C99
+# endif
+# endif
+#endif
+
+#ifndef C99
+
+typedef int _Bool;
+
+#define bool _Bool
+#define false 0
+#define true 1
+
+
+#else
+
+#include <stdbool.h>
+
+#endif
+
+#endif /* CELIXBOOL_H_ */
Propchange: incubator/celix/trunk/framework/private/include/celixbool.h
------------------------------------------------------------------------------
svn:mime-type = text/plain
Modified: incubator/celix/trunk/framework/private/include/version_range.h
URL:
http://svn.apache.org/viewvc/incubator/celix/trunk/framework/private/include/version_range.h?rev=1136423&r1=1136422&r2=1136423&view=diff
==============================================================================
--- incubator/celix/trunk/framework/private/include/version_range.h (original)
+++ incubator/celix/trunk/framework/private/include/version_range.h Thu Jun 16
13:08:52 2011
@@ -26,7 +26,7 @@
#ifndef VERSION_RANGE_H_
#define VERSION_RANGE_H_
-#include <stdbool.h>
+#include "celixbool.h"
#include "version.h"
Modified: incubator/celix/trunk/framework/private/src/framework.c
URL:
http://svn.apache.org/viewvc/incubator/celix/trunk/framework/private/src/framework.c?rev=1136423&r1=1136422&r2=1136423&view=diff
==============================================================================
--- incubator/celix/trunk/framework/private/src/framework.c (original)
+++ incubator/celix/trunk/framework/private/src/framework.c Thu Jun 16 13:08:52
2011
@@ -28,7 +28,7 @@
#include <dlfcn.h>
#include <sys/stat.h>
#include <sys/types.h>
-#include <stdbool.h>
+#include "celixbool.h"
#include <math.h>
#include <apr_file_io.h>
#include <apr_general.h>
Modified: incubator/celix/trunk/framework/private/src/manifest.c
URL:
http://svn.apache.org/viewvc/incubator/celix/trunk/framework/private/src/manifest.c?rev=1136423&r1=1136422&r2=1136423&view=diff
==============================================================================
--- incubator/celix/trunk/framework/private/src/manifest.c (original)
+++ incubator/celix/trunk/framework/private/src/manifest.c Thu Jun 16 13:08:52
2011
@@ -25,7 +25,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-#include <stdbool.h>
+#include "celixbool.h"
#include "manifest.h"
Modified: incubator/celix/trunk/utils/CMakeLists.txt
URL:
http://svn.apache.org/viewvc/incubator/celix/trunk/utils/CMakeLists.txt?rev=1136423&r1=1136422&r2=1136423&view=diff
==============================================================================
--- incubator/celix/trunk/utils/CMakeLists.txt (original)
+++ incubator/celix/trunk/utils/CMakeLists.txt Thu Jun 16 13:08:52 2011
@@ -21,6 +21,9 @@ aux_source_directory("private/src" SRC)
include_directories("private/include")
include_directories("public/include")
add_library(utils SHARED ${SRC})
-target_link_libraries(utils m)
-install(TARGETS utils LIBRARY DESTINATION lib COMPONENT framework)
+IF(UNIX)
+ target_link_libraries(utils m)
+ENDIF(UNIX)
+
+install(TARGETS utils LIBRARY DESTINATION lib ARCHIVE DESTINATION lib
COMPONENT framework)
Modified: incubator/celix/trunk/utils/private/src/array_list.c
URL:
http://svn.apache.org/viewvc/incubator/celix/trunk/utils/private/src/array_list.c?rev=1136423&r1=1136422&r2=1136423&view=diff
==============================================================================
--- incubator/celix/trunk/utils/private/src/array_list.c (original)
+++ incubator/celix/trunk/utils/private/src/array_list.c Thu Jun 16 13:08:52
2011
@@ -49,8 +49,9 @@ void arrayList_destroy(ARRAY_LIST list)
}
void arrayList_trimToSize(ARRAY_LIST list) {
+ int oldCapacity;
list->modCount++;
- int oldCapacity = list->capacity;
+ oldCapacity = list->capacity;
if (list->size < oldCapacity) {
void ** newList = (void **) realloc(list->elementData,
sizeof(void *) * list->size);
list->capacity = list->size;
@@ -59,14 +60,16 @@ void arrayList_trimToSize(ARRAY_LIST lis
}
void arrayList_ensureCapacity(ARRAY_LIST list, int capacity) {
+ void ** newList;
+ int oldCapacity;
list->modCount++;
- int oldCapacity = list->capacity;
+ oldCapacity = list->capacity;
if (capacity > oldCapacity) {
int newCapacity = (oldCapacity * 3) / 2 + 1;
if (newCapacity < capacity) {
newCapacity = capacity;
}
- void ** newList = (void **) realloc(list->elementData,
sizeof(void *) * newCapacity);
+ newList = (void **) realloc(list->elementData, sizeof(void *) *
newCapacity);
list->capacity = newCapacity;
list->elementData = newList;
}
@@ -132,11 +135,12 @@ void * arrayList_get(ARRAY_LIST list, un
}
void * arrayList_set(ARRAY_LIST list, unsigned int index, void * element) {
+ void * oldElement;
if (index >= list->size) {
return NULL;
}
- void * oldElement = list->elementData[index];
+ oldElement = list->elementData[index];
list->elementData[index] = element;
return oldElement;
}
@@ -148,11 +152,12 @@ bool arrayList_add(ARRAY_LIST list, void
}
int arrayList_addIndex(ARRAY_LIST list, unsigned int index, void * element) {
+ unsigned int numMoved;
if (index > list->size || index < 0) {
return -1;
}
arrayList_ensureCapacity(list, list->size+1);
- unsigned int numMoved = list->size - index;
+ numMoved = list->size - index;
memmove(list->elementData+(index+1), list->elementData+index,
sizeof(void *) * numMoved);
list->elementData[index] = element;
@@ -161,13 +166,15 @@ int arrayList_addIndex(ARRAY_LIST list,
}
void * arrayList_remove(ARRAY_LIST list, unsigned int index) {
+ void * oldElement;
+ unsigned int numMoved;
if (index >= list->size) {
return NULL;
}
list->modCount++;
- void * oldElement = list->elementData[index];
- unsigned int numMoved = list->size - index - 1;
+ oldElement = list->elementData[index];
+ numMoved = list->size - index - 1;
memmove(list->elementData+index, list->elementData+index+1, sizeof(void
*) * numMoved);
list->elementData[--list->size] = NULL;
@@ -175,9 +182,10 @@ void * arrayList_remove(ARRAY_LIST list,
}
void arrayList_fastRemove(ARRAY_LIST list, unsigned int index) {
+ unsigned int numMoved;
list->modCount++;
- unsigned int numMoved = list->size - index - 1;
+ numMoved = list->size - index - 1;
memmove(list->elementData+index, list->elementData+index+1, sizeof(void
*) * numMoved);
list->elementData[--list->size] = NULL;
}
@@ -204,9 +212,9 @@ bool arrayList_removeElement(ARRAY_LIST
}
void arrayList_clear(ARRAY_LIST list) {
+ int i;
list->modCount++;
- int i;
for (i = 0; i < list->size; i++) {
// free(list->elementData[i]);
list->elementData[i] = NULL;
@@ -215,11 +223,11 @@ void arrayList_clear(ARRAY_LIST list) {
}
bool arrayList_addAll(ARRAY_LIST list, ARRAY_LIST toAdd) {
+ int i;
int size = arrayList_size(toAdd);
arrayList_ensureCapacity(list, list->size + size);
// memcpy(list->elementData+list->size, *toAdd->elementData, size);
// list->size += size;
- int i;
for (i = 0; i < arrayList_size(toAdd); i++) {
arrayList_add(list, arrayList_get(toAdd, i));
}
@@ -264,10 +272,11 @@ bool arrayListIterator_hasNext(ARRAY_LIS
}
void * arrayListIterator_next(ARRAY_LIST_ITERATOR iterator) {
+ void * next;
if (iterator->expectedModificationCount != iterator->list->modCount) {
return NULL;
}
- void * next = arrayList_get(iterator->list, iterator->cursor);
+ next = arrayList_get(iterator->list, iterator->cursor);
iterator->lastReturned = iterator->cursor++;
return next;
}
@@ -277,11 +286,13 @@ bool arrayListIterator_hasPrevious(ARRAY
}
void * arrayListIterator_previous(ARRAY_LIST_ITERATOR iterator) {
+ int i;
+ void * previous;
if (iterator->expectedModificationCount != iterator->list->modCount) {
return NULL;
}
- int i = iterator->cursor - 1;
- void * previous = arrayList_get(iterator->list, i);
+ i = iterator->cursor - 1;
+ previous = arrayList_get(iterator->list, i);
iterator->lastReturned = iterator->cursor = i;
return previous;
}
Modified: incubator/celix/trunk/utils/private/src/hash_map.c
URL:
http://svn.apache.org/viewvc/incubator/celix/trunk/utils/private/src/hash_map.c?rev=1136423&r1=1136422&r2=1136423&view=diff
==============================================================================
--- incubator/celix/trunk/utils/private/src/hash_map.c (original)
+++ incubator/celix/trunk/utils/private/src/hash_map.c Thu Jun 16 13:08:52 2011
@@ -22,7 +22,7 @@
* Created on: Jul 21, 2010
* Author: alexanderb
*/
-#include <stdbool.h>
+#include "celixbool.h"
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
@@ -112,6 +112,8 @@ bool hashMap_isEmpty(HASH_MAP map) {
}
void * hashMap_get(HASH_MAP map, void * key) {
+ unsigned int hash;
+ HASH_MAP_ENTRY entry;
if (key == NULL) {
HASH_MAP_ENTRY entry = map->table[0];
for (entry = map->table[0]; entry != NULL; entry = entry->next)
{
@@ -122,8 +124,8 @@ void * hashMap_get(HASH_MAP map, void *
return NULL;
}
- unsigned int hash = hashMap_hash(map->hashKey(key));
- HASH_MAP_ENTRY entry = NULL;
+ hash = hashMap_hash(map->hashKey(key));
+ entry = NULL;
for (entry = map->table[hashMap_indexFor(hash, map->tablelength)];
entry != NULL; entry = entry->next) {
if (entry->hash == hash && (entry->key == key ||
map->equalsKey(key, entry->key))) {
return entry->value;
@@ -149,6 +151,9 @@ HASH_MAP_ENTRY hashMap_getEntry(HASH_MAP
}
void * hashMap_put(HASH_MAP map, void * key, void * value) {
+ unsigned int hash;
+ int i;
+ HASH_MAP_ENTRY entry;
if (key == NULL) {
HASH_MAP_ENTRY entry;
for (entry = map->table[0]; entry != NULL; entry = entry->next)
{
@@ -162,9 +167,9 @@ void * hashMap_put(HASH_MAP map, void *
hashMap_addEntry(map, 0, NULL, value, 0);
return NULL;
}
- unsigned int hash = hashMap_hash(map->hashKey(key));
- int i = hashMap_indexFor(hash, map->tablelength);
- HASH_MAP_ENTRY entry;
+ hash = hashMap_hash(map->hashKey(key));
+ i = hashMap_indexFor(hash, map->tablelength);
+
for (entry = map->table[i]; entry != NULL; entry = entry->next) {
if (entry->hash == hash && (entry->key == key ||
map->equalsKey(key, entry->key))) {
void * oldValue = entry->value;
@@ -178,12 +183,14 @@ void * hashMap_put(HASH_MAP map, void *
}
void hashMap_resize(HASH_MAP map, int newCapacity) {
+ HASH_MAP_ENTRY * newTable;
+ int j;
if (map->tablelength == MAXIMUM_CAPACITY) {
return;
}
- HASH_MAP_ENTRY * newTable = (HASH_MAP_ENTRY *)
malloc(sizeof(HASH_MAP_ENTRY) * newCapacity);
- int j;
+ newTable = (HASH_MAP_ENTRY *) malloc(sizeof(HASH_MAP_ENTRY) *
newCapacity);
+
for (j = 0; j < map->tablelength; j++) {
HASH_MAP_ENTRY entry = map->table[j];
if (entry != NULL) {
@@ -241,13 +248,17 @@ void * hashMap_removeEntryForKey(HASH_MA
}
HASH_MAP_ENTRY hashMap_removeMapping(HASH_MAP map, HASH_MAP_ENTRY entry) {
+ unsigned int hash;
+ HASH_MAP_ENTRY prev;
+ HASH_MAP_ENTRY e;
+ int i;
if (entry == NULL) {
return NULL;
}
- unsigned int hash = (entry->key == NULL) ? 0 :
hashMap_hash(map->hashKey(entry->key));
- int i = hashMap_indexFor(hash, map->tablelength);
- HASH_MAP_ENTRY prev = map->table[i];
- HASH_MAP_ENTRY e = prev;
+ hash = (entry->key == NULL) ? 0 :
hashMap_hash(map->hashKey(entry->key));
+ i = hashMap_indexFor(hash, map->tablelength);
+ prev = map->table[i];
+ e = prev;
while (e != NULL) {
HASH_MAP_ENTRY next = e->next;
@@ -269,9 +280,11 @@ HASH_MAP_ENTRY hashMap_removeMapping(HAS
}
void hashMap_clear(HASH_MAP map, bool freeKey, bool freeValue) {
- map->modificationCount++;
- HASH_MAP_ENTRY * table = map->table;
int i;
+ HASH_MAP_ENTRY * table;
+ map->modificationCount++;
+ table = map->table;
+
for (i = 0; i < map->tablelength; i++) {
HASH_MAP_ENTRY entry = table[i];
while (entry != NULL) {
@@ -289,8 +302,8 @@ void hashMap_clear(HASH_MAP map, bool fr
}
bool hashMap_containsValue(HASH_MAP map, void * value) {
+ int i;
if (value == NULL) {
- int i;
for (i = 0; i < map->tablelength; i++) {
HASH_MAP_ENTRY entry;
for (entry = map->table[i]; entry != NULL; entry =
entry->next) {
@@ -301,7 +314,6 @@ bool hashMap_containsValue(HASH_MAP map,
}
return false;
}
- int i;
for (i = 0; i < map->tablelength; i++) {
HASH_MAP_ENTRY entry;
for (entry = map->table[i]; entry != NULL; entry = entry->next)
{
@@ -355,24 +367,27 @@ bool hashMapIterator_hasNext(HASH_MAP_IT
}
void hashMapIterator_remove(HASH_MAP_ITERATOR iterator) {
+ void * key;
+ HASH_MAP_ENTRY entry;
if (iterator->current == NULL) {
return;
}
if (iterator->expectedModCount != iterator->map->modificationCount) {
return;
}
- void * key = iterator->current->key;
+ key = iterator->current->key;
iterator->current = NULL;
- HASH_MAP_ENTRY entry = hashMap_removeEntryForKey(iterator->map, key);
+ entry = hashMap_removeEntryForKey(iterator->map, key);
free(entry);
iterator->expectedModCount = iterator->map->modificationCount;
}
void * hashMapIterator_nextValue(HASH_MAP_ITERATOR iterator) {
+ HASH_MAP_ENTRY entry;
if (iterator->expectedModCount != iterator->map->modificationCount) {
return NULL;
}
- HASH_MAP_ENTRY entry = iterator->next;
+ entry = iterator->next;
if (entry == NULL) {
return NULL;
}
@@ -385,10 +400,11 @@ void * hashMapIterator_nextValue(HASH_MA
}
void * hashMapIterator_nextKey(HASH_MAP_ITERATOR iterator) {
+ HASH_MAP_ENTRY entry;
if (iterator->expectedModCount != iterator->map->modificationCount) {
return NULL;
}
- HASH_MAP_ENTRY entry = iterator->next;
+ entry = iterator->next;
if (entry == NULL) {
return NULL;
}
@@ -401,10 +417,11 @@ void * hashMapIterator_nextKey(HASH_MAP_
}
HASH_MAP_ENTRY hashMapIterator_nextEntry(HASH_MAP_ITERATOR iterator) {
+ HASH_MAP_ENTRY entry;
if (iterator->expectedModCount != iterator->map->modificationCount) {
return NULL;
}
- HASH_MAP_ENTRY entry = iterator->next;
+ entry = iterator->next;
if (entry == NULL) {
return NULL;
}
@@ -472,11 +489,13 @@ bool hashMapValues_contains(HASH_MAP_VAL
}
void hashMapValues_toArray(HASH_MAP_VALUES values, void* *array[], unsigned
int *size) {
+ HASH_MAP_ITERATOR it;
+ int i;
int vsize = hashMapValues_size(values);
*size = vsize;
*array = malloc(vsize * sizeof(*array));
- HASH_MAP_ITERATOR it = hashMapValues_iterator(values);
- int i = 0;
+ it = hashMapValues_iterator(values);
+ i = 0;
for (i = 0; i < vsize; i++) {
if (!hashMapIterator_hasNext(it)) {
return;
Modified: incubator/celix/trunk/utils/private/src/linked_list_iterator.c
URL:
http://svn.apache.org/viewvc/incubator/celix/trunk/utils/private/src/linked_list_iterator.c?rev=1136423&r1=1136422&r2=1136423&view=diff
==============================================================================
--- incubator/celix/trunk/utils/private/src/linked_list_iterator.c (original)
+++ incubator/celix/trunk/utils/private/src/linked_list_iterator.c Thu Jun 16
13:08:52 2011
@@ -37,10 +37,11 @@ struct linkedListIterator {
};
LINKED_LIST_ITERATOR linkedListIterator_create(LINKED_LIST list, int index) {
+ LINKED_LIST_ITERATOR iterator;
if (index < 0 || index > list->size) {
return NULL;
}
- LINKED_LIST_ITERATOR iterator = (LINKED_LIST_ITERATOR)
malloc(sizeof(*iterator));
+ iterator = (LINKED_LIST_ITERATOR) malloc(sizeof(*iterator));
iterator->lastReturned = list->header;
iterator->list = list;
iterator->expectedModificationCount = list->modificationCount;
@@ -112,10 +113,11 @@ int linkedListIterator_previousIndex(LIN
}
void linkedListIterator_remove(LINKED_LIST_ITERATOR iterator) {
+ LINKED_LIST_ENTRY lastNext;
if (iterator->list->modificationCount !=
iterator->expectedModificationCount) {
return;
}
- LINKED_LIST_ENTRY lastNext = iterator->lastReturned->next;
+ lastNext = iterator->lastReturned->next;
if (linkedList_removeEntry(iterator->list, iterator->lastReturned) ==
NULL) {
return;
}
Modified: incubator/celix/trunk/utils/private/src/linkedlist.c
URL:
http://svn.apache.org/viewvc/incubator/celix/trunk/utils/private/src/linkedlist.c?rev=1136423&r1=1136422&r2=1136423&view=diff
==============================================================================
--- incubator/celix/trunk/utils/private/src/linkedlist.c (original)
+++ incubator/celix/trunk/utils/private/src/linkedlist.c Thu Jun 16 13:08:52
2011
@@ -22,7 +22,7 @@
* Created on: Jul 16, 2010
* Author: alexanderb
*/
-#include <stdbool.h>
+#include "celixbool.h"
#include <stdio.h>
#include <stdlib.h>
@@ -152,12 +152,13 @@ void * linkedList_removeIndex(LINKED_LIS
}
LINKED_LIST_ENTRY linkedList_entry(LINKED_LIST list, int index) {
+ LINKED_LIST_ENTRY entry;
+ int i;
if (index < 0 || index >= list->size) {
return NULL;
}
- LINKED_LIST_ENTRY entry = list->header;
- int i;
+ entry = list->header;
if (index < (list->size >> 1)) {
for (i = 0; i <= index; i++) {
entry = entry->next;
@@ -210,11 +211,12 @@ LINKED_LIST_ENTRY linkedList_addBefore(L
}
void * linkedList_removeEntry(LINKED_LIST list, LINKED_LIST_ENTRY entry) {
+ void * result;
if (entry == list->header) {
return NULL;
}
- void * result = entry->element;
+ result = entry->element;
entry->previous->next = entry->next;
entry->next->previous = entry->previous;
Modified: incubator/celix/trunk/utils/public/include/array_list.h
URL:
http://svn.apache.org/viewvc/incubator/celix/trunk/utils/public/include/array_list.h?rev=1136423&r1=1136422&r2=1136423&view=diff
==============================================================================
--- incubator/celix/trunk/utils/public/include/array_list.h (original)
+++ incubator/celix/trunk/utils/public/include/array_list.h Thu Jun 16 13:08:52
2011
@@ -26,7 +26,7 @@
#ifndef ARRAY_LIST_H_
#define ARRAY_LIST_H_
-#include <stdbool.h>
+#include "celixbool.h"
typedef struct arrayList * ARRAY_LIST;
Modified: incubator/celix/trunk/utils/public/include/hash_map.h
URL:
http://svn.apache.org/viewvc/incubator/celix/trunk/utils/public/include/hash_map.h?rev=1136423&r1=1136422&r2=1136423&view=diff
==============================================================================
--- incubator/celix/trunk/utils/public/include/hash_map.h (original)
+++ incubator/celix/trunk/utils/public/include/hash_map.h Thu Jun 16 13:08:52
2011
@@ -26,7 +26,7 @@
#ifndef HASH_MAP_H_
#define HASH_MAP_H_
-#include <stdbool.h>
+#include "celixbool.h"
typedef struct hashMapEntry * HASH_MAP_ENTRY;
typedef struct hashMap * HASH_MAP;
Modified: incubator/celix/trunk/utils/public/include/linked_list_iterator.h
URL:
http://svn.apache.org/viewvc/incubator/celix/trunk/utils/public/include/linked_list_iterator.h?rev=1136423&r1=1136422&r2=1136423&view=diff
==============================================================================
--- incubator/celix/trunk/utils/public/include/linked_list_iterator.h (original)
+++ incubator/celix/trunk/utils/public/include/linked_list_iterator.h Thu Jun
16 13:08:52 2011
@@ -26,7 +26,7 @@
#ifndef LINKED_LIST_ITERATOR_H_
#define LINKED_LIST_ITERATOR_H_
-#include <stdbool.h>
+#include "celixbool.h"
#include "linkedlist.h"
Modified: incubator/celix/trunk/utils/public/include/linkedlist.h
URL:
http://svn.apache.org/viewvc/incubator/celix/trunk/utils/public/include/linkedlist.h?rev=1136423&r1=1136422&r2=1136423&view=diff
==============================================================================
--- incubator/celix/trunk/utils/public/include/linkedlist.h (original)
+++ incubator/celix/trunk/utils/public/include/linkedlist.h Thu Jun 16 13:08:52
2011
@@ -26,7 +26,7 @@
#ifndef LINKEDLIST_H_
#define LINKEDLIST_H_
-#include <stdbool.h>
+#include "celixbool.h"
typedef struct linkedListEntry * LINKED_LIST_ENTRY;
typedef struct linkedList * LINKED_LIST;
Modified: incubator/celix/trunk/whiteboard/tracker/activator.c
URL:
http://svn.apache.org/viewvc/incubator/celix/trunk/whiteboard/tracker/activator.c?rev=1136423&r1=1136422&r2=1136423&view=diff
==============================================================================
--- incubator/celix/trunk/whiteboard/tracker/activator.c (original)
+++ incubator/celix/trunk/whiteboard/tracker/activator.c Thu Jun 16 13:08:52
2011
@@ -25,7 +25,7 @@
#include <stdlib.h>
#include <pthread.h>
#include <unistd.h>
-#include <stdbool.h>
+#include "celixbool.h"
#include "bundle_activator.h"
#include "publisher.h"
Modified: incubator/celix/trunk/whiteboard/tracker_depman/dependency_activator.c
URL:
http://svn.apache.org/viewvc/incubator/celix/trunk/whiteboard/tracker_depman/dependency_activator.c?rev=1136423&r1=1136422&r2=1136423&view=diff
==============================================================================
--- incubator/celix/trunk/whiteboard/tracker_depman/dependency_activator.c
(original)
+++ incubator/celix/trunk/whiteboard/tracker_depman/dependency_activator.c Thu
Jun 16 13:08:52 2011
@@ -26,7 +26,7 @@
#include <stdio.h>
#include <pthread.h>
#include <unistd.h>
-#include <stdbool.h>
+#include "celixbool.h"
#include "dependency_activator_base.h"
#include "service_component_private.h"
Modified: incubator/celix/trunk/whiteboard/tracker_depman/tracker.c
URL:
http://svn.apache.org/viewvc/incubator/celix/trunk/whiteboard/tracker_depman/tracker.c?rev=1136423&r1=1136422&r2=1136423&view=diff
==============================================================================
--- incubator/celix/trunk/whiteboard/tracker_depman/tracker.c (original)
+++ incubator/celix/trunk/whiteboard/tracker_depman/tracker.c Thu Jun 16
13:08:52 2011
@@ -8,7 +8,7 @@
#include <stdio.h>
#include <pthread.h>
#include <unistd.h>
-#include <stdbool.h>
+#include "celixbool.h"
#include "service.h"
#include "publisher.h"