[Tizen-submit] 21491: Changes to Tizen:IVI/tizen-platform-wrapper
noreply at tizen.org
noreply at tizen.org
Fri Feb 21 15:36:25 GMT 2014
Hi,
Stephane Desneux have made the following changes to tizen-platform-wrapper in project Tizen:IVI. Please review and accept ASAP.
Thank You,
[This message was auto-generated]
---
Request: #21491
submit: Tizen:IVI:build/tizen-platform-wrapper(cleanup) -> Tizen:IVI
Message:
Submitter: Stephane Desneux <stephane.desneux at open.eurogiciel.org>
Comments: reduce possible mistakes on tzplatform_xxx calls
Git project: platform/core/appfw/tizen-platform-wrapper
Tag: submit/tizen/20140221.153548
Commit: ddda0a79a93d4fae22b39467b0d095267f5ea66b Instanciation of strings returned by mkpath...
State: new 2014-02-21T15:36:05 tizenrobot
Comment: <no comment>
spec files:
-----------
--- tizen-platform-wrapper.spec
+++ tizen-platform-wrapper.spec
@@ -1,5 +1,5 @@
Name: tizen-platform-wrapper
-VCS: platform/core/appfw/tizen-platform-wrapper#77b86d13106db5f0955f0c31e02b0396efa012d3
+VCS: platform/core/appfw/tizen-platform-wrapper#ddda0a79a93d4fae22b39467b0d095267f5ea66b
Version: 1.0
Release: 0
License: LGPL-2.0
other changes:
--------------
++++++ tizen-platform-wrapper-1.0.tar.bz2
--- src/scratch.c
+++ src/scratch.c
@@ -28,6 +28,7 @@
#endif
#include <stdlib.h>
+#include <memory.h>
#ifndef INITIAL_SCRATCH_CAPACITY
#define INITIAL_SCRATCH_CAPACITY 240
@@ -37,6 +38,16 @@
#error "bad value for INITIAL_SCRATCH_CAPACITY"
#endif
+#define INSTANCIATE 1
+#if INSTANCIATE
+#define SET_CAPACITY 97
+#define HASHCODE_INIT 5381
+#define HASHCODE_NEXT(H,C) (((H) << 5) + (H) + (C))
+#ifndef NOT_MULTI_THREAD_SAFE
+#define NOT_MULTI_THREAD_SAFE
+#endif
+#endif
+
#ifndef NOT_MULTI_THREAD_SAFE
#include <pthread.h>
static pthread_key_t tlskey;
@@ -45,6 +56,59 @@
static void *global_scratch = NULL;
#endif
+#if INSTANCIATE
+/* structure for recording items in the hash map */
+struct set_item {
+ struct set_item *next; /* chain to next item */
+ size_t hashcode; /* hash of the string */
+ size_t length; /* length of the string including null */
+};
+
+/* the array of recorded strings */
+static struct set_item *global_path_set[SET_CAPACITY]; /* initialized to zeros */
+
+/* instanciate (or retrieve an instance) of the 'string' that
+is granted to have the 'length' including terminating null and a
+hash code 'hashcode' */
+static const char *instantiate(const char *string, size_t length, size_t hashcode)
+{
+ struct set_item **pp, *item;
+ char *result;
+
+ /* get first item in the table */
+ pp = &global_path_set[hashcode % SET_CAPACITY];
+ result = 0;
+ do {
+ /* inspect the item */
+ item = *pp;
+ if (!item) {
+ /* no item: create it */
+ item = malloc(length + sizeof * item);
+ if (!item)
+ return NULL;
+ /* init it */
+ item->next = 0;
+ item->hashcode = hashcode;
+ item->length = length;
+ result = (char *)(item + 1);
+ memcpy(result, string, length);
+ /* record it */
+ *pp = item;
+ } else if (item->hashcode == hashcode
Please refer to OBS webUI for more details about this SR.
More information about the Tizen-submit
mailing list