From 458b0f24cb663f2e6feed3e171d1389b3c166a6f Mon Sep 17 00:00:00 2001 From: Douglas Clowes Date: Thu, 29 Nov 2012 10:08:15 +1100 Subject: [PATCH] Add a path field --- fitcenter.c | 2 +- hipadaba.c | 17 ++++++++++++++++- hipadaba.h | 1 + 3 files changed, 18 insertions(+), 2 deletions(-) diff --git a/fitcenter.c b/fitcenter.c index a91ae0ed..f4d0112e 100644 --- a/fitcenter.c +++ b/fitcenter.c @@ -78,7 +78,7 @@ void DeleteFitCenter(void *pData) } /*--------------------------------------------------------------------------*/ -void SmoothScanCounts(long *lData, int iDataLen) +static void SmoothScanCounts(long *lData, int iDataLen) { int ind = (int) (sizeof(ggf1) / sizeof(float) - 1) / 2; long *pData = (long *) malloc(iDataLen * sizeof(long)); diff --git a/hipadaba.c b/hipadaba.c index b0bf067d..0dd1c186 100644 --- a/hipadaba.c +++ b/hipadaba.c @@ -127,6 +127,9 @@ void DeleteNodeData(pHdb node) if (node->name != NULL) { free(node->name); } + if (node->path != NULL) { + free(node->path); + } ReleaseHdbValue(&node->value); node->magic = 000000; @@ -562,7 +565,7 @@ int compareHdbValue(hdbValue v1, hdbValue v2) } break; case HIPFLOAT: - if (ABS(v1.v.doubleValue - v2.v.doubleValue) < .01) { + if (ABS(v1.v.doubleValue - v2.v.doubleValue) < .0001) { /* DFC */ return 1; } else { return 0; @@ -737,6 +740,7 @@ void AddHipadabaChild(pHdb parent, pHdb child, void *callData) * step to end of child chain */ while (current != NULL) { + assert(strcmp(current->name, child->name) != 0); prev = current; current = current->next; } @@ -856,6 +860,7 @@ char *GetHipadabaPath(pHdb node) strcat(pPtr, "/"); strcat(pPtr, nodeStack[i]->name); } + node->path = pPtr; return pPtr; } @@ -1112,6 +1117,16 @@ void SetHdbProperty(pHdb node, char *key, char *value) } } +/*---------------------------------------------------------------------------*/ +int HasHdbProperty(pHdb node, char *key) +{ + if (node != NULL && node->properties != NULL) { + return StringDictExists(node->properties, key); + } else { + return 0; + } +} + /*---------------------------------------------------------------------------*/ int GetHdbProperty(pHdb node, char *key, char *value, int len) { diff --git a/hipadaba.h b/hipadaba.h index 29523287..dd3803c9 100644 --- a/hipadaba.h +++ b/hipadaba.h @@ -70,6 +70,7 @@ typedef struct __hipadaba { struct __hipadaba *next; struct __hdbcallback *callBackChain; char *name; + char *path; hdbValue value; int protected; pStringDict properties;