Git-Url: 
http://git.frugalware.org/gitweb/gitweb.cgi?p=fwsetup-ng.git;a=commitdiff;h=9beb0653480461f433c1d2452bc2c45206eff5c9

commit 9beb0653480461f433c1d2452bc2c45206eff5c9
Author: James Buren <[email protected]>
Date:   Tue Aug 14 15:12:59 2012 -0500

convert free_string to work with mods to list_free

diff --git a/fwsetup.c b/fwsetup.c
index a4d78f6..7991c55 100644
--- a/fwsetup.c
+++ b/fwsetup.c
@@ -1,6 +1,6 @@
#include "fwsetup.h"

-#define MODULE_COUNT (2 + 2)
+#define MODULE_COUNT (2 + 3)
#define EMPTY_MODULE (&(struct module) { 0, 0 })

static struct database db;
@@ -17,7 +17,9 @@ extern int main(void)

modules[1] = begin_module;

-  modules[2] = end_module;
+  modules[2] = partition_setup_module;
+
+  modules[3] = end_module;

db.locale = setlocale(LC_ALL,"");

diff --git a/fwsetup.h b/fwsetup.h
index abeebae..a0b66a8 100644
--- a/fwsetup.h
+++ b/fwsetup.h
@@ -122,7 +122,7 @@ extern void *list_append(void *list,size_t n);
extern void *list_find_start(void *list);
extern void *list_find_end(void *list);
extern void list_free(void *list,void (*cb) (void *));
-extern void string_free(void *string);
+extern void free_string(void *p);
extern void free_partition(void *p);
extern struct device *read_device_data(const char *path);
extern bool write_device_data(const struct device *device);
diff --git a/partition_setup.c b/partition_setup.c
index 7f6680b..a2eaf58 100644
--- a/partition_setup.c
+++ b/partition_setup.c
@@ -2,7 +2,13 @@

static enum order partition_setup_run(struct database *db)
{
-       return 0;
+  assert(db != 0);
+
+  struct device *device = read_device_data("test.img");
+
+  free_device(device);
+
+  return ORDER_NEXT;
}

struct module partition_setup_module =
@@ -10,3 +16,5 @@ struct module partition_setup_module =
__FILE__,
partition_setup_run
};
+
+// -%- strip: yes; add-newline: yes; use-tabs: no; indent-width: 2; tab-width: 
2; -%-
diff --git a/utility.c b/utility.c
index 87f0464..d5287ef 100644
--- a/utility.c
+++ b/utility.c
@@ -261,13 +261,16 @@ extern void list_free(void *list,void (*cb) (void *))
}
}

-extern void string_free(void *string)
+extern void free_string(void *p)
{
-  assert(string != 0);
+  if(p == 0)
+    return;
+
+  struct string *string = p;

-  struct string *p = string;
+  free(string->data);

-  free(p->data);
+  free(string);
}

extern void free_partition(void *p)
_______________________________________________
Frugalware-git mailing list
[email protected]
http://frugalware.org/mailman/listinfo/frugalware-git

Reply via email to