Commits

Michał Górny committed a0987ce

Don't mix decls and code.

Comments (0)

Files changed (1)

 
 static PyObject *BootMountpoint_new(PyTypeObject *type, PyObject *args, PyObject *kwds) {
 	struct libmnt_context* const ctx = mnt_new_context();
+	PyObject *self;
 
 	if (!ctx)
 		return PyErr_Format(PyExc_RuntimeError,
 				"unable to create libmount context");
 
-	PyObject *self = type->tp_alloc(type, 0);
+	self = type->tp_alloc(type, 0);
 
 	if (self != NULL) {
 		BootMountpoint* const b = (BootMountpoint*) self;
 static PyObject *BootMountpoint_mount(PyObject *args, PyObject *kwds) {
 	BootMountpoint* const self = (BootMountpoint*) args;
 	struct libmnt_context* const ctx = self->mnt_context;
+	struct libmnt_table *mtab;
 
 	BootMountpoint_reset(ctx);
 
-	struct libmnt_table *mtab;
 	if (mnt_context_get_mtab(ctx, &mtab))
 		return PyErr_Format(PyExc_RuntimeError,
 				"unable to get mtab");
 
 	/* backward -> find the top-most mount */
-	struct libmnt_fs* const fs = mnt_table_find_target(mtab, "/boot",
-			MNT_ITER_BACKWARD);
-
-	if (!fs) { /* boot not mounted, mount it? */
+	if (!mnt_table_find_target(mtab, "/boot", MNT_ITER_BACKWARD)) {
 		struct libmnt_table *fstab;
 		if (mnt_context_get_fstab(ctx, &fstab))
 			return PyErr_Format(PyExc_RuntimeError,
 static PyObject *BootMountpoint_rwmount(PyObject *args, PyObject *kwds) {
 	BootMountpoint* const self = (BootMountpoint*) args;
 	struct libmnt_context* const ctx = self->mnt_context;
+	struct libmnt_table *mtab;
+	struct libmnt_fs* fs;
 
 	BootMountpoint_reset(ctx);
 
-	struct libmnt_table *mtab;
 	if (mnt_context_get_mtab(ctx, &mtab))
 		return PyErr_Format(PyExc_RuntimeError,
 				"unable to get mtab");
 
 	/* backward -> find the top-most mount */
-	struct libmnt_fs* const fs = mnt_table_find_target(mtab, "/boot",
+	fs = mnt_table_find_target(mtab, "/boot",
 			MNT_ITER_BACKWARD);
 
 	if (!fs) { /* boot not mounted, mount it? */
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.