public inbox for lvm2-cvs@sourceware.org
help / color / mirror / Atom feed
* LVM2 ./WHATS_NEW lib/format_text/import.c
@ 2008-03-13 12:33 agk
  0 siblings, 0 replies; only message in thread
From: agk @ 2008-03-13 12:33 UTC (permalink / raw)
  To: lvm-devel, lvm2-cvs

CVSROOT:	/cvs/lvm2
Module name:	LVM2
Changes by:	agk@sourceware.org	2008-03-13 12:33:25

Modified files:
	.              : WHATS_NEW 
	lib/format_text: import.c 

Log message:
	Refactor text format initialisation into _init_text_import.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.802&r2=1.803
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/format_text/import.c.diff?cvsroot=lvm2&r1=1.45&r2=1.46

--- LVM2/WHATS_NEW	2008/03/12 16:03:21	1.802
+++ LVM2/WHATS_NEW	2008/03/13 12:33:21	1.803
@@ -1,5 +1,6 @@
 Version 2.02.34 -
 ===================================
+  Refactor text format initialisation into _init_text_import.
   Escape double quotes and backslashes in external metadata and config data.
   Add functions for escaping double quotes in strings.
   Rename count_chars_len to count_chars.
--- LVM2/lib/format_text/import.c	2008/01/30 13:59:59	1.45
+++ LVM2/lib/format_text/import.c	2008/03/13 12:33:22	1.46
@@ -23,6 +23,18 @@
 /* FIXME Use tidier inclusion method */
 static struct text_vg_version_ops *(_text_vsn_list[2]);
 
+static int _text_import_initialised = 0;
+
+static void _init_text_import()
+{
+	if (_text_import_initialised)
+		return;
+
+	_text_vsn_list[0] = text_vg_vsn1_init();
+	_text_vsn_list[1] = NULL;
+	_text_import_initialised = 1;
+}
+
 const char *text_vgname_import(const struct format_type *fmt,
 			       struct device *dev,
 			       off_t offset, uint32_t size,
@@ -35,13 +47,7 @@
 	struct text_vg_version_ops **vsn;
 	const char *vgname = NULL;
 
-	static int _text_import_initialised = 0;
-
-	if (!_text_import_initialised) {
-		_text_vsn_list[0] = text_vg_vsn1_init();
-		_text_vsn_list[1] = NULL;
-		_text_import_initialised = 1;
-	}
+	_init_text_import();
 
 	if (!(cft = create_config_tree(NULL, 0)))
 		return_NULL;
@@ -83,13 +89,7 @@
 	struct config_tree *cft;
 	struct text_vg_version_ops **vsn;
 
-	static int _text_vg_import_initialised = 0;
-
-	if (!_text_vg_import_initialised) {
-		_text_vsn_list[0] = text_vg_vsn1_init();
-		_text_vsn_list[1] = NULL;
-		_text_vg_import_initialised = 1;
-	}
+	_init_text_import();
 
 	*desc = NULL;
 	*when = 0;


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2008-03-13 12:33 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-03-13 12:33 LVM2 ./WHATS_NEW lib/format_text/import.c agk

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).