From 3ddb5c9f81ea4ed2c88cdadffda282304001a75f Mon Sep 17 00:00:00 2001 From: dmiller Date: Wed, 1 Mar 2017 20:41:15 +0000 Subject: [PATCH] Optimize utility function removechar. Closes #670 by shikharsrivastava --- nping/utils.cc | 24 ++++++++---------------- 1 file changed, 8 insertions(+), 16 deletions(-) diff --git a/nping/utils.cc b/nping/utils.cc index 43a3b871f..b6c84919d 100644 --- a/nping/utils.cc +++ b/nping/utils.cc @@ -316,26 +316,18 @@ int bitcmp(u8 *a, u8*b, int len){ /** Removes every instance of the character stored in parameter "c" in the * supplied string. - * @warning the supplied buffer is modified by this function. Whenever a - * colon is found, the rest of the string is moved one position to the left - * so the colon gets overwritten. */ + * @warning the supplied buffer is modified by this function. */ int removechar(char *string, char c){ - size_t len=0, i=0, j=0; + size_t i=0, j=0; if(string==NULL) return OP_FAILURE; - len=strlen(string); - for(i=0; i