diff options
author | Jörg Mayer <jmayer@loplof.de> | 2005-02-03 23:18:23 +0000 |
---|---|---|
committer | Jörg Mayer <jmayer@loplof.de> | 2005-02-03 23:18:23 +0000 |
commit | c49b92ea308c9813177409fa9b5222af6505e68c (patch) | |
tree | 12e0ee68497ca33ef6506a2b0f8c41b673227e3d /epan/to_str.c | |
parent | 326165db2b49924788c2cc16791c192a40f37e13 (diff) |
Yniv Kaul: Small performance optimization
It change a while()->do, to do->while() and removes a variable (and an
assignment to it).
svn path=/trunk/; revision=13270
Diffstat (limited to 'epan/to_str.c')
-rw-r--r-- | epan/to_str.c | 29 |
1 files changed, 14 insertions, 15 deletions
diff --git a/epan/to_str.c b/epan/to_str.c index 050d5fa053..7cc334c24b 100644 --- a/epan/to_str.c +++ b/epan/to_str.c @@ -141,7 +141,7 @@ ether_to_str(const guint8 *ad) gchar * ip_to_str(const guint8 *ad) { static gchar str[4][16]; - static int cur_idx=0; + static guint32 cur_idx=0; gchar *cur; cur_idx++; @@ -197,34 +197,33 @@ ip_to_str_buf(const guint8 *ad, gchar *buf) { register gchar const *p; register gchar *b=buf; - register gchar c; p=fast_strings[*ad++]; - while((c=*p)){ - *b++=c; + do { + *b++=*p; p++; - } + } while(*p); *b++='.'; p=fast_strings[*ad++]; - while((c=*p)){ - *b++=c; + do { + *b++=*p; p++; - } + } while(*p); *b++='.'; p=fast_strings[*ad++]; - while((c=*p)){ - *b++=c; + do { + *b++=*p; p++; - } + } while(*p); *b++='.'; - p=fast_strings[*ad++]; - while((c=*p)){ - *b++=c; + p=fast_strings[*ad]; + do { + *b++=*p; p++; - } + } while(*p); *b=0; } |