[PATCH] Remove use of alloca in libparted/arch/linux.c
Frodo Baggins
frodo.drogo at gmail.com
Sat Sep 8 21:49:04 UTC 2007
alloca is system-specific and usually not recommended. Hence
substituting it with static allocation.
---
libparted/arch/linux.c | 8 ++++----
1 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/libparted/arch/linux.c b/libparted/arch/linux.c
index 648bd2b..0c97796 100644
--- a/libparted/arch/linux.c
+++ b/libparted/arch/linux.c
@@ -2214,7 +2214,7 @@ static int
_dm_is_part (struct dm_info *this, char *name)
{
struct dm_task* task = NULL;
- struct dm_info* info = alloca(sizeof *info);
+ struct dm_info info;
struct dm_deps* deps = NULL;
int rc = 0;
unsigned int i;
@@ -2231,9 +2231,9 @@ _dm_is_part (struct dm_info *this, char
}
rc = 0;
- memset(info, '\0', sizeof *info);
- dm_task_get_info(task, info);
- if (!info->exists)
+ memset(&info, '\0', sizeof (struct dm_info));
+ dm_task_get_info(task, &info);
+ if (!info.exists)
goto err;
deps = dm_task_get_deps(task);
More information about the parted-devel
mailing list