[gnumeric] excelplugins: don't use alloca.
- From: Morten Welinder <mortenw src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnumeric] excelplugins: don't use alloca.
- Date: Thu, 30 Nov 2017 16:26:47 +0000 (UTC)
commit 092b689743623b48950e8694ad624492328032f8
Author: Morten Welinder <terra gnome org>
Date: Thu Nov 30 11:25:56 2017 -0500
excelplugins: don't use alloca.
plugins/excelplugins/ChangeLog | 5 +++++
plugins/excelplugins/xlcall32_emulation.c | 8 +++++---
2 files changed, 10 insertions(+), 3 deletions(-)
---
diff --git a/plugins/excelplugins/ChangeLog b/plugins/excelplugins/ChangeLog
index 1f72b82..3410bab 100644
--- a/plugins/excelplugins/ChangeLog
+++ b/plugins/excelplugins/ChangeLog
@@ -1,3 +1,8 @@
+2017-11-30 Morten Welinder <terra gnome org>
+
+ * xlcall32_emulation.c (Excel4): Avoid alloca to avoid
+ over-allocating on the stack.
+
2017-11-18 Morten Welinder <terra gnome org>
* Release 1.12.36
diff --git a/plugins/excelplugins/xlcall32_emulation.c b/plugins/excelplugins/xlcall32_emulation.c
index 1d7f34f..46eea64 100644
--- a/plugins/excelplugins/xlcall32_emulation.c
+++ b/plugins/excelplugins/xlcall32_emulation.c
@@ -58,14 +58,16 @@ G_MODULE_EXPORT int far pascal Excel4v(int xlfn, void* operRes, int count, void*
}
G_MODULE_EXPORT int far _cdecl Excel4(int xlfn, void* operRes, int count, ...) {
- void **opers=(void**)alloca(count*sizeof(void*));
+ void **opers=g_new(void *, MAX(1,count));
va_list arg_list;
- int i;
+ int i, res;
va_start(arg_list,count);
for (i=0;i<count;++i)
opers[i]=va_arg(arg_list,void*);
va_end(arg_list);
- return Excel4v(xlfn,operRes,count,(void**)opers);
+ res = Excel4v(xlfn,operRes,count,opers);
+ g_free (opers);
+ return res;
}
int far pascal XLCallVer(void){
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]