[PATCH 06/10] Replace literal "80" with a named constant

Kevin Cernekee cernekee at gmail.com
Sun Oct 7 21:03:40 EDT 2012


Signed-off-by: Kevin Cernekee <cernekee at gmail.com>
---
 main.c |    9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/main.c b/main.c
index e68ff29..4d5cb0e 100644
--- a/main.c
+++ b/main.c
@@ -73,6 +73,9 @@ static int process_auth_form(void *_vpninfo,
 #include "version.c"
 #undef openconnect_version_str
 
+/* Default size for user responses */
+#define USER_BUFLEN 80
+
 int verbose = PRG_INFO;
 int background;
 int do_passphrase_from_fsid;
@@ -973,7 +976,7 @@ static int validate_peer_cert(void *_vpninfo, OPENCONNECT_X509 *peer_cert,
 	}
 
 	while (1) {
-		char buf[80];
+		char buf[USER_BUFLEN];
 		char *details;
 		char *p;
 
@@ -1062,11 +1065,11 @@ static int prompt_opt(struct openconnect_info *vpninfo, struct oc_form_opt *opt,
 		return -1;
 	}
 
-	opt->value=malloc(80);
+	opt->value = malloc(USER_BUFLEN);
 	if (!opt->value)
 		return -1;
 
-	ret = prompt_user(opt->label, opt->value, 80, hide_chars);
+	ret = prompt_user(opt->label, opt->value, USER_BUFLEN, hide_chars);
 
 	if (ret < 0) {
 		free(opt->value);
-- 
1.7.5.4




More information about the openconnect-devel mailing list