Thread (36 messages) flat view 36 messages, 6 authors, 2016-06-15

Re: [PATCH 2/2] Move unsigned long option parsing out of pack-objects.c

From: Charles Bailey <hidden>
Date: 2016-06-15 23:05:25

On Sun, Jun 21, 2015 at 07:25:44PM +0100, Charles Bailey wrote:
quoted hunk ↗ jump to hunk
From: Charles Bailey <redacted>
diff --git a/parse-options.c b/parse-options.c
index 80106c0..101b649 100644
--- a/parse-options.c
+++ b/parse-options.c
@@ -180,6 +180,23 @@ static int get_value(struct parse_opt_ctx_t *p,
 			return opterror(opt, "expects a numerical value", flags);
 		return 0;
 
+	case OPTION_MAGNITUDE:
+		if (unset) {
+			*(unsigned long *)opt->value = 0;
+			return 0;
+		}
+		if (opt->flags & PARSE_OPT_OPTARG && !p->opt) {
+			*(unsigned long *)opt->value = opt->defval;
+			return 0;
+		}
+		if (get_arg(p, opt, flags, &arg))
+			return -1;
+		if (!git_parse_ulong(arg, opt->value))
+			return opterror(opt,
+				"expects a integer value with an optional k/m/g suffix",
+				flags);
+		return 0;
+
Spotted after sending:
s/expects a integer/expects an integer/
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help