Mercurial > mplayer.hg
changeset 33049:fc7a3f9f74f8
Simplify strswap().
(A special return value for empty strings isn't needed.)
author | ib |
---|---|
date | Mon, 28 Mar 2011 16:03:26 +0000 |
parents | c6d0adf896ea |
children | 36d0701bb4c8 |
files | gui/util/string.c |
diffstat | 1 files changed, 6 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/gui/util/string.c Mon Mar 28 15:51:20 2011 +0000 +++ b/gui/util/string.c Mon Mar 28 16:03:26 2011 +0000 @@ -23,14 +23,14 @@ char *strswap(char *in, char from, char to) { - int i; + char *p = in; - if (!*in) - return NULL; + while (*p) { + if (*p == from) + *p = to; - for (i = 0; in[i]; i++) - if (in[i] == from) - in[i] = to; + p++; + } return in; }