[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r3688 - in GNUnet/src: applications/fs/fsui util/config_imp
From: |
grothoff |
Subject: |
[GNUnet-SVN] r3688 - in GNUnet/src: applications/fs/fsui util/config_impl |
Date: |
Fri, 10 Nov 2006 18:52:09 -0800 (PST) |
Author: grothoff
Date: 2006-11-10 18:52:06 -0800 (Fri, 10 Nov 2006)
New Revision: 3688
Modified:
GNUnet/src/applications/fs/fsui/search.c
GNUnet/src/util/config_impl/impl.c
Log:
fix
Modified: GNUnet/src/applications/fs/fsui/search.c
===================================================================
--- GNUnet/src/applications/fs/fsui/search.c 2006-11-11 02:51:53 UTC (rev
3687)
+++ GNUnet/src/applications/fs/fsui/search.c 2006-11-11 02:52:06 UTC (rev
3688)
@@ -137,8 +137,9 @@
if (ECRS_equalsUri(fi->uri,
pos->resultsReceived[i].uri)) {
#if DEBUG_SEARCH
- GE_LOG(ectx, GE_DEBUG | GE_REQUEST | GE_USER,
- "Received search result that I have seen before.\n");
+ GE_LOG(ectx,
+ GE_DEBUG | GE_REQUEST | GE_USER,
+ "Received search result that I have seen before.\n");
#endif
return OK; /* seen before */
}
@@ -146,8 +147,9 @@
if (key == NULL) {
GE_BREAK(ectx, 0);
#if DEBUG_SEARCH
- GE_LOG(ectx, GE_DEBUG | GE_REQUEST | GE_USER,
- "Received search result without key to decrypt.\n");
+ GE_LOG(ectx,
+ GE_DEBUG | GE_REQUEST | GE_USER,
+ "Received search result without key to decrypt.\n");
#endif
return SYSERR;
}
@@ -160,15 +162,17 @@
&rp->matchingKeys[j],
sizeof(HashCode512))) {
#if DEBUG_SEARCH
- GE_LOG(ectx, GE_DEBUG | GE_REQUEST | GE_USER,
- "Received search result that I have seen before (missing
keyword to show client).\n");
+ GE_LOG(ectx,
+ GE_DEBUG | GE_REQUEST | GE_USER,
+ "Received search result that I have seen before (missing
keyword to show client).\n");
#endif
return OK;
}
if (rp->matchingKeyCount + 1 == pos->numberOfURIKeys) {
#if DEBUG_SEARCH
- GE_LOG(ectx, GE_DEBUG | GE_REQUEST | GE_USER,
- "Received search result (showing client)!\n");
+ GE_LOG(ectx,
+ GE_DEBUG | GE_REQUEST | GE_USER,
+ "Received search result (showing client)!\n");
#endif
GROW(rp->matchingKeys,
rp->matchingKeyCount,
@@ -210,15 +214,17 @@
1);
rp->matchingKeys[0] = *key;
#if DEBUG_SEARCH
- GE_LOG(ectx, GE_DEBUG | GE_REQUEST | GE_USER,
- "Received search result (waiting for %u more keys before showing
client).\n",
- pos->numberOfURIKeys - rp->matchingKeyCount);
+ GE_LOG(ectx,
+ GE_DEBUG | GE_REQUEST | GE_USER,
+ "Received search result (waiting for %u more keys before showing
client).\n",
+ pos->numberOfURIKeys - rp->matchingKeyCount);
#endif
return OK;
} else {
#if DEBUG_SEARCH
- GE_LOG(ectx, GE_DEBUG | GE_REQUEST | GE_USER,
- "Received search result (showing client)!\n");
+ GE_LOG(ectx,
+ GE_DEBUG | GE_REQUEST | GE_USER,
+ "Received search result (showing client)!\n");
#endif
processResult(fi,
pos);
Modified: GNUnet/src/util/config_impl/impl.c
===================================================================
--- GNUnet/src/util/config_impl/impl.c 2006-11-11 02:51:53 UTC (rev 3687)
+++ GNUnet/src/util/config_impl/impl.c 2006-11-11 02:52:06 UTC (rev 3688)
@@ -672,6 +672,29 @@
}
/**
+ * Test if we have a value for a particular option
+ * @return YES if so, NO if not.
+ */
+static int
+_have_configuration_value(struct GC_Configuration * cfg,
+ const char * section,
+ const char * option) {
+ GC_Entry * e;
+ int ret;
+
+ MUTEX_LOCK(cfg->data->lock);
+ e = findEntry(cfg->data,
+ section,
+ option);
+ if (e == NULL)
+ ret = NO;
+ else
+ ret = YES;
+ MUTEX_UNLOCK(cfg->data->lock);
+ return ret;
+}
+
+/**
* Expand an expression of the form "$FOO/BAR" to "DIRECTORY/BAR"
* where either in the current section or globally FOO is set to
* DIRECTORY.
@@ -702,28 +725,32 @@
post = &orig[i+1];
}
prefix = NULL;
- if (0 != _get_configuration_value_string(cfg,
- section,
- &orig[1],
- "",
- &prefix)) {
- FREE(prefix);
- if (0 != _get_configuration_value_string(cfg,
- "",
- &orig[1],
- "",
- &prefix)) {
- const char * env = getenv(&orig[1]);
+ if (YES == _have_configuration_value(cfg,
+ section,
+ &orig[1])) {
+ _get_configuration_value_string(cfg,
+ section,
+ &orig[1],
+ "",
+ &prefix);
+ } else if (_have_configuration_value(cfg,
+ "",
+ &orig[1])) {
+ _get_configuration_value_string(cfg,
+ "",
+ &orig[1],
+ "",
+ &prefix);
+ } else {
+ const char * env = getenv(&orig[1]);
- FREE(prefix);
- if (env != NULL) {
- prefix = STRDUP(env);
- } else {
- orig[i] = DIR_SEPARATOR;
- return orig;
- }
+ if (env != NULL) {
+ prefix = STRDUP(env);
+ } else {
+ orig[i] = DIR_SEPARATOR;
+ return orig;
}
- }
+ }
result = MALLOC(strlen(prefix) +
strlen(post) + 2);
strcpy(result, prefix);
@@ -840,29 +867,6 @@
}
/**
- * Test if we have a value for a particular option
- * @return YES if so, NO if not.
- */
-static int
-_have_configuration_value(struct GC_Configuration * cfg,
- const char * section,
- const char * option) {
- GC_Entry * e;
- int ret;
-
- MUTEX_LOCK(cfg->data->lock);
- e = findEntry(cfg->data,
- section,
- option);
- if (e == NULL)
- ret = NO;
- else
- ret = YES;
- MUTEX_UNLOCK(cfg->data->lock);
- return ret;
-}
-
-/**
* Create a GC_Configuration (C implementation).
*/
GC_Configuration *
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r3688 - in GNUnet/src: applications/fs/fsui util/config_impl,
grothoff <=