[hackers] [ubase] No need for a temporary variable in streplace() || sin

From: <git_AT_suckless.org>
Date: Thu, 17 Apr 2014 18:18:58 +0200

commit 87cb818ac027c000d491b01f9636c4a1a5e42b21
Author: sin <sin_AT_2f30.org>
Date: Thu Apr 17 17:15:36 2014 +0100

    No need for a temporary variable in streplace()

diff --git a/sysctl.c b/sysctl.c
index eb656c7..290f917 100644
--- a/sysctl.c
+++ b/sysctl.c
_AT_@ -10,11 +10,9 @@
 static void
 streplace(char *s, int a, int b)
 {
- char *p;
-
- for (p = s; *p; p++)
- if (*p == a)
- *p = b;
+ for (; *s; s++)
+ if (*s == a)
+ *s = b;
 }
 
 static int
Received on Thu Apr 17 2014 - 18:18:58 CEST

This archive was generated by hypermail 2.3.0 : Thu Apr 17 2014 - 18:24:16 CEST