Message ID | 1421175905-17035-20-git-send-email-colin.king@canonical.com |
---|---|
State | Accepted |
Headers | show |
On 01/14/2015 03:04 AM, Colin King wrote: > From: Colin Ian King <colin.king@canonical.com> > > cppcheck is picking up some minor style issues which can > be easily fixed: > > [src/cpu/maxfreq/maxfreq.c:36]: > (style) The scope of the variable 'val' can be reduced. > > Signed-off-by: Colin Ian King <colin.king@canonical.com> > --- > src/cpu/maxfreq/maxfreq.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/src/cpu/maxfreq/maxfreq.c b/src/cpu/maxfreq/maxfreq.c > index a5b3558..0d7bbb9 100644 > --- a/src/cpu/maxfreq/maxfreq.c > +++ b/src/cpu/maxfreq/maxfreq.c > @@ -33,9 +33,10 @@ > static double maxfreq_max(const char *str) > { > double max = -1.0; > - double val; > > while (str && *str) { > + double val; > + > while ((*str != '\0') && isspace(*str)) > str++; > > Acked-by: Ivan Hu <ivan.hu@canonical.com>
On Wed, Jan 14, 2015 at 3:04 AM, Colin King <colin.king@canonical.com> wrote: > From: Colin Ian King <colin.king@canonical.com> > > cppcheck is picking up some minor style issues which can > be easily fixed: > > [src/cpu/maxfreq/maxfreq.c:36]: > (style) The scope of the variable 'val' can be reduced. > > Signed-off-by: Colin Ian King <colin.king@canonical.com> > --- > src/cpu/maxfreq/maxfreq.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/src/cpu/maxfreq/maxfreq.c b/src/cpu/maxfreq/maxfreq.c > index a5b3558..0d7bbb9 100644 > --- a/src/cpu/maxfreq/maxfreq.c > +++ b/src/cpu/maxfreq/maxfreq.c > @@ -33,9 +33,10 @@ > static double maxfreq_max(const char *str) > { > double max = -1.0; > - double val; > > while (str && *str) { > + double val; > + > while ((*str != '\0') && isspace(*str)) > str++; > > -- > 2.1.4 > > Acked-by: Keng-Yu Lin <kengyu@canonical.com>
diff --git a/src/cpu/maxfreq/maxfreq.c b/src/cpu/maxfreq/maxfreq.c index a5b3558..0d7bbb9 100644 --- a/src/cpu/maxfreq/maxfreq.c +++ b/src/cpu/maxfreq/maxfreq.c @@ -33,9 +33,10 @@ static double maxfreq_max(const char *str) { double max = -1.0; - double val; while (str && *str) { + double val; + while ((*str != '\0') && isspace(*str)) str++;