perf: Fix endianness argument compatibility with OPT_BOOLEAN() and introduce OPT_INCR()
[linux-3.10.git] / tools / perf / util / parse-options.c
index 79dfa0c..ed88764 100644 (file)
@@ -49,6 +49,7 @@ static int get_value(struct parse_opt_ctx_t *p,
                                break;
                        /* FALLTHROUGH */
                case OPTION_BOOLEAN:
+               case OPTION_INCR:
                case OPTION_BIT:
                case OPTION_SET_INT:
                case OPTION_SET_PTR:
@@ -73,6 +74,10 @@ static int get_value(struct parse_opt_ctx_t *p,
                return 0;
 
        case OPTION_BOOLEAN:
+               *(bool *)opt->value = unset ? false : true;
+               return 0;
+
+       case OPTION_INCR:
                *(int *)opt->value = unset ? 0 : *(int *)opt->value + 1;
                return 0;
 
@@ -478,6 +483,7 @@ int usage_with_options_internal(const char * const *usagestr,
                case OPTION_GROUP:
                case OPTION_BIT:
                case OPTION_BOOLEAN:
+               case OPTION_INCR:
                case OPTION_SET_INT:
                case OPTION_SET_PTR:
                case OPTION_LONG: