about summary refs log tree commit diff stats
path: root/src/common.c
diff options
context:
space:
mode:
authorJames Booth <boothj5@gmail.com>2012-10-21 20:02:20 +0100
committerJames Booth <boothj5@gmail.com>2012-10-21 20:02:20 +0100
commit6bad38c2d50a033d8e8a19998cb062e01fe1aa72 (patch)
tree781461a7d79b6fce56f5ee7f0a012e814cf8771f /src/common.c
parent382e961563eb9e4d31d3ad111a41569b7fa78fa6 (diff)
downloadprofani-tty-6bad38c2d50a033d8e8a19998cb062e01fe1aa72.tar.gz
Removed trailing whitespace from src and tests
Diffstat (limited to 'src/common.c')
-rw-r--r--src/common.c34
1 files changed, 17 insertions, 17 deletions
diff --git a/src/common.c b/src/common.c
index 078e8ae4..c9a5612e 100644
--- a/src/common.c
+++ b/src/common.c
@@ -1,8 +1,8 @@
-/* 
+/*
  * common.c
  *
  * Copyright (C) 2012 James Booth <boothj5@gmail.com>
- * 
+ *
  * This file is part of Profanity.
  *
  * Profanity is free software: you can redistribute it and/or modify
@@ -50,20 +50,20 @@ create_dir(char *name)
 }
 
 char *
-str_replace(const char *string, const char *substr, 
-    const char *replacement) 
+str_replace(const char *string, const char *substr,
+    const char *replacement)
 {
     char *tok = NULL;
     char *newstr = NULL;
     char *oldstr = NULL;
     char *head = NULL;
- 
+
     if (string == NULL)
         return NULL;
 
-    if ( substr == NULL || 
-         replacement == NULL || 
-         (strcmp(substr, "") == 0)) 
+    if ( substr == NULL ||
+         replacement == NULL ||
+         (strcmp(substr, "") == 0))
         return strdup (string);
 
     newstr = strdup (string);
@@ -71,26 +71,26 @@ str_replace(const char *string, const char *substr,
 
     while ( (tok = strstr ( head, substr ))) {
         oldstr = newstr;
-        newstr = malloc ( strlen ( oldstr ) - strlen ( substr ) + 
+        newstr = malloc ( strlen ( oldstr ) - strlen ( substr ) +
             strlen ( replacement ) + 1 );
-        
-        if ( newstr == NULL ) { 
+
+        if ( newstr == NULL ) {
             free (oldstr);
             return NULL;
         }
-        
+
         memcpy ( newstr, oldstr, tok - oldstr );
         memcpy ( newstr + (tok - oldstr), replacement, strlen ( replacement ) );
-        memcpy ( newstr + (tok - oldstr) + strlen( replacement ), 
-            tok + strlen ( substr ), 
+        memcpy ( newstr + (tok - oldstr) + strlen( replacement ),
+            tok + strlen ( substr ),
             strlen ( oldstr ) - strlen ( substr ) - ( tok - oldstr ) );
-        memset ( newstr + strlen ( oldstr ) - strlen ( substr ) + 
+        memset ( newstr + strlen ( oldstr ) - strlen ( substr ) +
             strlen ( replacement ) , 0, 1 );
-        
+
         head = newstr + (tok - oldstr) + strlen( replacement );
         free (oldstr);
     }
-  
+
     return newstr;
 }