summaryrefslogtreecommitdiff
path: root/src/transport/transport-testing-filenames.c
diff options
context:
space:
mode:
authorng0 <ng0@n0.is>2019-09-08 12:33:09 +0000
committerng0 <ng0@n0.is>2019-09-08 12:33:09 +0000
commitd41ed82a4ea0cc8e1674b6d5d2c49fd6462610bb (patch)
tree9efd18ea7d425652085ed0bd5e8e45604bc5f6b9 /src/transport/transport-testing-filenames.c
parenta0fce305c565c0937d917a92712f15e9c5736260 (diff)
uncrustify as demanded.
Diffstat (limited to 'src/transport/transport-testing-filenames.c')
-rw-r--r--src/transport/transport-testing-filenames.c124
1 files changed, 62 insertions, 62 deletions
diff --git a/src/transport/transport-testing-filenames.c b/src/transport/transport-testing-filenames.c
index 4c2fbd3f5..865907007 100644
--- a/src/transport/transport-testing-filenames.c
+++ b/src/transport/transport-testing-filenames.c
@@ -11,12 +11,12 @@
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Affero General Public License for more details.
-
+
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
SPDX-License-Identifier: AGPL3.0-or-later
-*/
+ */
/**
* @file transport-testing-filenames.c
* @brief convenience string manipulation functions for tests
@@ -33,49 +33,49 @@
* @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 WINDOWS
- if ((strlen (pch) >= 3) && pch[1] == ':')
- {
- if (NULL != strstr (pch, "\\"))
+ if ((strlen(pch) >= 3) && pch[1] == ':')
{
- pch = strtok (pch, "\\");
- while (pch != NULL)
- {
- pch = strtok (NULL, "\\");
- if (pch != NULL)
- filename = pch;
- }
+ if (NULL != strstr(pch, "\\"))
+ {
+ pch = strtok(pch, "\\");
+ while (pch != NULL)
+ {
+ pch = strtok(NULL, "\\");
+ if (pch != NULL)
+ filename = pch;
+ }
+ }
}
- }
if (filename != NULL)
pch = filename; /* If we miss the next condition, filename = pch will
* not harm us.
*/
#endif
- if (NULL != strstr (pch, "/"))
- {
- pch = strtok (pch, "/");
- while (pch != NULL)
+ if (NULL != strstr(pch, "/"))
{
- pch = strtok (NULL, "/");
- if (pch != NULL)
- {
- filename = pch;
- }
+ pch = strtok(pch, "/");
+ while (pch != NULL)
+ {
+ 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;
}
@@ -88,9 +88,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;
@@ -99,18 +99,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;
}
@@ -122,12 +122,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;
@@ -142,40 +142,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;
}
@@ -189,10 +189,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;
@@ -200,20 +200,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;
}