summaryrefslogtreecommitdiff
path: root/src/transport/transport-testing-filenames.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2019-10-05 15:09:28 +0200
committerChristian Grothoff <christian@grothoff.org>2019-10-05 15:09:28 +0200
commitc4e9ba925ffd758aaa3feee2ccfc0b76f26fe207 (patch)
treecac3ce030d77b4cbe7c7dc62ed58cfe6d24f73e1 /src/transport/transport-testing-filenames.c
parentfbb71d527c7d6babf269a8fefce1db291b9f7068 (diff)
global reindent, now with uncrustify hook enabled
Diffstat (limited to 'src/transport/transport-testing-filenames.c')
-rw-r--r--src/transport/transport-testing-filenames.c98
1 files changed, 49 insertions, 49 deletions
diff --git a/src/transport/transport-testing-filenames.c b/src/transport/transport-testing-filenames.c
index 8d493864e..7c136b690 100644
--- a/src/transport/transport-testing-filenames.c
+++ b/src/transport/transport-testing-filenames.c
@@ -33,30 +33,30 @@
* @return extracted file name, has to be freed by caller
*/
static char *
-extract_filename(const char *file)
+extract_filename (const char *file)
{
- char *pch = GNUNET_strdup(file);
+ char *pch = GNUNET_strdup (file);
char *backup = pch;
char *filename = NULL;
char *res;
- if (NULL != strstr(pch, "/"))
+ if (NULL != strstr (pch, "/"))
+ {
+ pch = strtok (pch, "/");
+ while (pch != NULL)
{
- pch = strtok(pch, "/");
- while (pch != NULL)
- {
- pch = strtok(NULL, "/");
- if (pch != NULL)
- {
- filename = pch;
- }
- }
+ pch = strtok (NULL, "/");
+ if (pch != NULL)
+ {
+ filename = pch;
+ }
}
+ }
else
filename = pch;
- res = GNUNET_strdup(filename);
- GNUNET_free(backup);
+ res = GNUNET_strdup (filename);
+ GNUNET_free (backup);
return res;
}
@@ -69,9 +69,9 @@ extract_filename(const char *file)
* @return the result
*/
char *
-GNUNET_TRANSPORT_TESTING_get_test_name(const char *file)
+GNUNET_TRANSPORT_TESTING_get_test_name (const char *file)
{
- char *backup = extract_filename(file);
+ char *backup = extract_filename (file);
char *filename = backup;
char *dotexe;
char *ret;
@@ -80,18 +80,18 @@ GNUNET_TRANSPORT_TESTING_get_test_name(const char *file)
return NULL;
/* remove "lt-" */
- filename = strstr(filename, "test");
+ filename = strstr (filename, "test");
if (NULL == filename)
- {
- GNUNET_free(backup);
- return NULL;
- }
+ {
+ GNUNET_free (backup);
+ return NULL;
+ }
/* remove ".exe" */
- if (NULL != (dotexe = strstr(filename, ".exe")))
+ if (NULL != (dotexe = strstr (filename, ".exe")))
dotexe[0] = '\0';
- ret = GNUNET_strdup(filename);
- GNUNET_free(backup);
+ ret = GNUNET_strdup (filename);
+ GNUNET_free (backup);
return ret;
}
@@ -103,12 +103,12 @@ GNUNET_TRANSPORT_TESTING_get_test_name(const char *file)
* @return the result
*/
char *
-GNUNET_TRANSPORT_TESTING_get_test_source_name(const char *file)
+GNUNET_TRANSPORT_TESTING_get_test_source_name (const char *file)
{
- char *src = extract_filename(file);
+ char *src = extract_filename (file);
char *split;
- split = strstr(src, ".");
+ split = strstr (src, ".");
if (NULL != split)
split[0] = '\0';
return src;
@@ -123,40 +123,40 @@ GNUNET_TRANSPORT_TESTING_get_test_source_name(const char *file)
* @return the result
*/
char *
-GNUNET_TRANSPORT_TESTING_get_test_plugin_name(const char *file,
- const char *test)
+GNUNET_TRANSPORT_TESTING_get_test_plugin_name (const char *file,
+ const char *test)
{
char *filename;
char *dotexe;
- char *e = extract_filename(file);
- char *t = extract_filename(test);
+ char *e = extract_filename (file);
+ char *t = extract_filename (test);
char *ret;
if (NULL == e)
goto fail;
/* remove "lt-" */
- filename = strstr(e, "tes");
+ filename = strstr (e, "tes");
if (NULL == filename)
goto fail;
/* remove ".exe" */
- if (NULL != (dotexe = strstr(filename, ".exe")))
+ if (NULL != (dotexe = strstr (filename, ".exe")))
dotexe[0] = '\0';
/* find last _ */
- filename = strstr(filename, t);
+ filename = strstr (filename, t);
if (NULL == filename)
goto fail;
/* copy plugin */
- filename += strlen(t);
+ filename += strlen (t);
if ('\0' != *filename)
filename++;
- ret = GNUNET_strdup(filename);
+ ret = GNUNET_strdup (filename);
goto suc;
fail:
ret = NULL;
suc:
- GNUNET_free(t);
- GNUNET_free(e);
+ GNUNET_free (t);
+ GNUNET_free (e);
return ret;
}
@@ -170,10 +170,10 @@ suc:
* @return the result
*/
char *
-GNUNET_TRANSPORT_TESTING_get_config_name(const char *file,
- int count)
+GNUNET_TRANSPORT_TESTING_get_config_name (const char *file,
+ int count)
{
- char *filename = extract_filename(file);
+ char *filename = extract_filename (file);
char *backup = filename;
char *dotexe;
char *ret;
@@ -181,20 +181,20 @@ GNUNET_TRANSPORT_TESTING_get_config_name(const char *file,
if (NULL == filename)
return NULL;
/* remove "lt-" */
- filename = strstr(filename, "test");
+ filename = strstr (filename, "test");
if (NULL == filename)
goto fail;
/* remove ".exe" */
- if (NULL != (dotexe = strstr(filename, ".exe")))
+ if (NULL != (dotexe = strstr (filename, ".exe")))
dotexe[0] = '\0';
- GNUNET_asprintf(&ret,
- "%s_peer%u.conf",
- filename,
- count);
- GNUNET_free(backup);
+ GNUNET_asprintf (&ret,
+ "%s_peer%u.conf",
+ filename,
+ count);
+ GNUNET_free (backup);
return ret;
fail:
- GNUNET_free(backup);
+ GNUNET_free (backup);
return NULL;
}