From 494697b0ee0552a932b4a21e879e6c99a54ddabd Mon Sep 17 00:00:00 2001
From: Alessandro Rubini <rubini@gnudd.com>
Date: Wed, 18 Sep 2013 23:18:37 +0200
Subject: [PATCH] arch startup: alloc max_links instances

The next commit makes a little order in startup files, and config file
parsing ends up after all allocations, so we can't reply on
ppg->nlinks to be properly set.

In hosted environments we have no issues with a few kilobytes more, so
allocate the max number of instances even if less are used.

Signed-off-by: Alessandro Rubini <rubini@gnudd.com>
---
 arch-unix/unix-startup.c | 2 +-
 arch-wrs/wrs-startup.c   | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch-unix/unix-startup.c b/arch-unix/unix-startup.c
index 337e1508..794b6b36 100644
--- a/arch-unix/unix-startup.c
+++ b/arch-unix/unix-startup.c
@@ -76,7 +76,7 @@ int main(int argc, char **argv)
 	ppg->parentDS = calloc(1, sizeof(*ppg->parentDS));
 	ppg->timePropertiesDS = calloc(1, sizeof(*ppg->timePropertiesDS));
 	ppg->arch_data = calloc(1, sizeof(struct unix_arch_data));
-	ppg->pp_instances = calloc(ppg->nlinks, sizeof(struct pp_instance));
+	ppg->pp_instances = calloc(ppg->max_links, sizeof(struct pp_instance));
 
 	if ((!ppg->defaultDS) || (!ppg->currentDS) || (!ppg->parentDS)
 		|| (!ppg->timePropertiesDS) || (!ppg->arch_data)
diff --git a/arch-wrs/wrs-startup.c b/arch-wrs/wrs-startup.c
index 2458175a..b784edb8 100644
--- a/arch-wrs/wrs-startup.c
+++ b/arch-wrs/wrs-startup.c
@@ -103,7 +103,7 @@ int main(int argc, char **argv)
 	ppg->parentDS = calloc(1, sizeof(*ppg->parentDS));
 	ppg->timePropertiesDS = calloc(1, sizeof(*ppg->timePropertiesDS));
 	ppg->arch_data = calloc(1, sizeof(struct unix_arch_data));
-	ppg->pp_instances = calloc(ppg->nlinks, sizeof(struct pp_instance));
+	ppg->pp_instances = calloc(ppg->max_links, sizeof(struct pp_instance));
 
 	if ((!ppg->defaultDS) || (!ppg->currentDS) || (!ppg->parentDS)
 		|| (!ppg->timePropertiesDS) || (!ppg->arch_data)
-- 
GitLab