Patchwork [5/5] Remove obsolete 'f' double parameter type

login
register
mail settings
Submitter Jes Sorensen
Date Sept. 16, 2010, 2:52 p.m.
Message ID <1284648749-18479-6-git-send-email-Jes.Sorensen@redhat.com>
Download mbox | patch
Permalink /patch/64991/
State New
Headers show

Comments

Jes Sorensen - Sept. 16, 2010, 2:52 p.m.
From: Jes Sorensen <Jes.Sorensen@redhat.com>

'f' double is no longer used, and we should be using floating point
variables to store byte sizes. Remove it.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
---
 monitor.c |   17 +----------------
 1 files changed, 1 insertions(+), 16 deletions(-)
Markus Armbruster - Sept. 28, 2010, 10:08 a.m.
Jes.Sorensen@redhat.com writes:

> From: Jes Sorensen <Jes.Sorensen@redhat.com>
>
> 'f' double is no longer used, and we should be using floating point
> variables to store byte sizes. Remove it.
>
> Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
> ---
>  monitor.c |   17 +----------------
>  1 files changed, 1 insertions(+), 16 deletions(-)
>
> diff --git a/monitor.c b/monitor.c
> index 3630061..ffeb4ee 100644
> --- a/monitor.c
> +++ b/monitor.c
> @@ -83,10 +83,6 @@
>   *              suffix, which multiplies the value by 2^40 for
>   *              suffixes T and t, 2^30 for suffixes G and g, 2^20 for
>   *              M and m, 2^10 for K and k
> - * 'f'          double
> - *              user mode accepts an optional G, g, M, m, K, k suffix,
> - *              which multiplies the value by 2^30 for suffixes G and
> - *              g, 2^20 for M and m, 2^10 for K and k
>   * 'T'          double
>   *              user mode accepts an optional ms, us, ns suffix,
>   *              which divides the value by 1e3, 1e6, 1e9, respectively
> @@ -3621,7 +3617,6 @@ static const mon_cmd_t *monitor_parse_command(Monitor *mon,
>                  p = end;
>              }
>              break;
> -        case 'f':
>          case 'T':
>              {
>                  double val;
> @@ -3637,17 +3632,7 @@ static const mon_cmd_t *monitor_parse_command(Monitor *mon,
>                  if (get_double(mon, &val, &p) < 0) {
>                      goto fail;
>                  }
> -                if (c == 'f' && *p) {
> -                    switch (*p) {
> -                    case 'K': case 'k':
> -                        val *= 1 << 10; p++; break;
> -                    case 'M': case 'm':
> -                        val *= 1 << 20; p++; break;
> -                    case 'G': case 'g':
> -                        val *= 1 << 30; p++; break;
> -                    }
> -                }
> -                if (c == 'T' && p[0] && p[1] == 's') {
> +                if (p[0] && p[1] == 's') {
>                      switch (*p) {
>                      case 'm':
>                          val /= 1e3; p += 2; break;

You missed check_client_args_type().

Yes, the monitor code sucks rocks.

Patch

diff --git a/monitor.c b/monitor.c
index 3630061..ffeb4ee 100644
--- a/monitor.c
+++ b/monitor.c
@@ -83,10 +83,6 @@ 
  *              suffix, which multiplies the value by 2^40 for
  *              suffixes T and t, 2^30 for suffixes G and g, 2^20 for
  *              M and m, 2^10 for K and k
- * 'f'          double
- *              user mode accepts an optional G, g, M, m, K, k suffix,
- *              which multiplies the value by 2^30 for suffixes G and
- *              g, 2^20 for M and m, 2^10 for K and k
  * 'T'          double
  *              user mode accepts an optional ms, us, ns suffix,
  *              which divides the value by 1e3, 1e6, 1e9, respectively
@@ -3621,7 +3617,6 @@  static const mon_cmd_t *monitor_parse_command(Monitor *mon,
                 p = end;
             }
             break;
-        case 'f':
         case 'T':
             {
                 double val;
@@ -3637,17 +3632,7 @@  static const mon_cmd_t *monitor_parse_command(Monitor *mon,
                 if (get_double(mon, &val, &p) < 0) {
                     goto fail;
                 }
-                if (c == 'f' && *p) {
-                    switch (*p) {
-                    case 'K': case 'k':
-                        val *= 1 << 10; p++; break;
-                    case 'M': case 'm':
-                        val *= 1 << 20; p++; break;
-                    case 'G': case 'g':
-                        val *= 1 << 30; p++; break;
-                    }
-                }
-                if (c == 'T' && p[0] && p[1] == 's') {
+                if (p[0] && p[1] == 's') {
                     switch (*p) {
                     case 'm':
                         val /= 1e3; p += 2; break;