summaryrefslogtreecommitdiff
path: root/monitor_wrap.c
diff options
context:
space:
mode:
authordjm@openbsd.org <djm@openbsd.org>2017-10-05 15:52:03 +0000
committerDamien Miller <djm@mindrot.org>2017-10-20 12:01:02 +1100
commitdceabc7ad7ebc7769c8214a1647af64c9a1d92e5 (patch)
tree513eb2c60aafcc240cd9bc2027a4f919a2934978 /monitor_wrap.c
parent2b4f3ab050c2aaf6977604dd037041372615178d (diff)
upstream commit
replace statically-sized arrays in ServerOptions with dynamic ones managed by xrecallocarray, removing some arbitrary (though large) limits and saving a bit of memory; "much nicer" markus@ Upstream-ID: 1732720b2f478fe929d6687ac7b0a97ff2efe9d2
Diffstat (limited to 'monitor_wrap.c')
-rw-r--r--monitor_wrap.c10
1 files changed, 3 insertions, 7 deletions
diff --git a/monitor_wrap.c b/monitor_wrap.c
index 69212aaf3..a46628fb1 100644
--- a/monitor_wrap.c
+++ b/monitor_wrap.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: monitor_wrap.c,v 1.94 2017/10/02 19:33:20 djm Exp $ */ 1/* $OpenBSD: monitor_wrap.c,v 1.95 2017/10/05 15:52:03 djm Exp $ */
2/* 2/*
3 * Copyright 2002 Niels Provos <provos@citi.umich.edu> 3 * Copyright 2002 Niels Provos <provos@citi.umich.edu>
4 * Copyright 2002 Markus Friedl <markus@openbsd.org> 4 * Copyright 2002 Markus Friedl <markus@openbsd.org>
@@ -287,19 +287,15 @@ out:
287 newopts->x = buffer_get_string(&m, NULL); \ 287 newopts->x = buffer_get_string(&m, NULL); \
288 } while (0) 288 } while (0)
289#define M_CP_STRARRAYOPT(x, nx) do { \ 289#define M_CP_STRARRAYOPT(x, nx) do { \
290 for (i = 0; i < newopts->nx; i++) \
291 newopts->x[i] = buffer_get_string(&m, NULL); \
292 } while (0)
293#define M_CP_STRARRAYOPT_ALLOC(x, nx) do { \
294 newopts->x = newopts->nx == 0 ? \ 290 newopts->x = newopts->nx == 0 ? \
295 NULL : xcalloc(newopts->nx, sizeof(*newopts->x)); \ 291 NULL : xcalloc(newopts->nx, sizeof(*newopts->x)); \
296 M_CP_STRARRAYOPT(x, nx); \ 292 for (i = 0; i < newopts->nx; i++) \
293 newopts->x[i] = buffer_get_string(&m, NULL); \
297 } while (0) 294 } while (0)
298 /* See comment in servconf.h */ 295 /* See comment in servconf.h */
299 COPY_MATCH_STRING_OPTS(); 296 COPY_MATCH_STRING_OPTS();
300#undef M_CP_STROPT 297#undef M_CP_STROPT
301#undef M_CP_STRARRAYOPT 298#undef M_CP_STRARRAYOPT
302#undef M_CP_STRARRAYOPT_ALLOC
303 299
304 copy_set_server_options(&options, newopts, 1); 300 copy_set_server_options(&options, newopts, 1);
305 log_change_level(options.log_level); 301 log_change_level(options.log_level);