Selaa lähdekoodia

libdpkg: Rename error_unwind() to pop_error_context()

Guillem Jover 15 vuotta sitten
vanhempi
commit
2a92bb8118
9 muutettua tiedostoa jossa 21 lisäystä ja 16 poistoa
  1. 1 1
      lib/dpkg/dpkg.h
  2. 9 4
      lib/dpkg/ehandle.c
  3. 1 1
      lib/dpkg/ehandle.h
  4. 1 1
      lib/dpkg/libdpkg.Versions
  5. 1 2
      lib/dpkg/test.h
  6. 2 2
      src/archives.c
  7. 1 1
      src/main.c
  8. 3 2
      src/packages.c
  9. 2 2
      src/trigproc.c

+ 1 - 1
lib/dpkg/dpkg.h

@@ -112,7 +112,7 @@ DPKG_BEGIN_DECLS
 } while (0)
 
 #define standard_shutdown() do { \
-  error_unwind(ehflag_normaltidy);\
+  pop_error_context(ehflag_normaltidy); \
 } while (0)
 
 /*** log.c ***/

+ 9 - 4
lib/dpkg/ehandle.c

@@ -233,7 +233,12 @@ run_cleanups(struct error_context *econ, int flagsetin)
   preventrecurse--;
 }
 
-void error_unwind(int flagset) {
+/**
+ * Unwind the current error context by running its registered cleanups.
+ */
+void
+pop_error_context(int flagset)
+{
   struct error_context *tecp;
 
   tecp= econtext;
@@ -247,10 +252,10 @@ void error_unwind(int flagset) {
 }
 
 void push_checkpoint(int mask, int value) {
-  /* This will arrange that when error_unwind() is called,
+  /* This will arrange that when pop_error_context() is called,
    * all previous cleanups will be executed with
    *  flagset= (original_flagset & mask) | value
-   * where original_flagset is the argument to error_unwind
+   * where original_flagset is the argument to pop_error_context()
    * (as modified by any checkpoint which was pushed later).
    */
   struct cleanup_entry *cep;
@@ -337,7 +342,7 @@ void ohshit(const char *fmt, ...) {
 void
 catch_fatal_error(void)
 {
-  error_unwind(ehflag_bombout);
+  pop_error_context(ehflag_bombout);
   exit(2);
 }
 

+ 1 - 1
lib/dpkg/ehandle.h

@@ -53,7 +53,7 @@ void push_error_context_jump(jmp_buf *jbufp, error_printer *printerror,
 void push_error_context_func(error_handler *func, error_printer *printerror,
                              const char *contextstring);
 void push_error_context(void);
-void error_unwind(int flagset);
+void pop_error_context(int flagset);
 
 void push_cleanup(void (*f1)(int argc, void **argv), int flagmask1,
                   void (*f2)(int argc, void **argv), int flagmask2,

+ 1 - 1
lib/dpkg/libdpkg.Versions

@@ -12,12 +12,12 @@ LIBDPKG_PRIVATE {
 	push_error_context_jump;
 	push_error_context_func;
 	push_error_context;
+	pop_error_context;
 	print_fatal_error;
 	catch_fatal_error;
 	push_checkpoint;
 	push_cleanup;
 	pop_cleanup;
-	error_unwind;
 	onerr_abort;		# XXX variable, do not export
 	ohshitv;
 	ohshite;

+ 1 - 2
lib/dpkg/test.h

@@ -47,8 +47,7 @@ main(int argc, char **argv)
 
 	test();
 
-	/* Shutdown. */
-	error_unwind(ehflag_normaltidy);
+	pop_error_context(ehflag_normaltidy);
 
 	return 0;
 }

+ 2 - 2
src/archives.c

@@ -1247,7 +1247,7 @@ void archivefiles(const char *const *argv) {
   
   while ((thisarg = *argp++) != NULL) {
     if (setjmp(ejbuf)) {
-      error_unwind(ehflag_bombout);
+      pop_error_context(ehflag_bombout);
       if (abort_processing)
         break;
       continue;
@@ -1259,7 +1259,7 @@ void archivefiles(const char *const *argv) {
     m_output(stderr, _("<standard error>"));
     onerr_abort--;
 
-    error_unwind(ehflag_normaltidy);
+    pop_error_context(ehflag_normaltidy);
   }
 
   switch (cipaction->arg) {

+ 1 - 1
src/main.c

@@ -655,7 +655,7 @@ void commandfd(const char *const *argv) {
     actionfunction= (void (*)(const char* const*))cipaction->farg;
     actionfunction(newargs);
 
-    error_unwind(ehflag_normaltidy);
+    pop_error_context(ehflag_normaltidy);
   }
 }
 

+ 3 - 2
src/packages.c

@@ -215,7 +215,8 @@ void process_queue(void) {
     if (setjmp(ejbuf)) {
       /* give up on it from the point of view of other packages, ie reset istobe */
       pkg->clientdata->istobe= itb_normal;
-      error_unwind(ehflag_bombout);
+
+      pop_error_context(ehflag_bombout);
       if (abort_processing)
         return;
       continue;
@@ -249,7 +250,7 @@ void process_queue(void) {
     m_output(stdout, _("<standard output>"));
     m_output(stderr, _("<standard error>"));
 
-    error_unwind(ehflag_normaltidy);
+    pop_error_context(ehflag_normaltidy);
   }
   assert(!queue.length);
 }    

+ 2 - 2
src/trigproc.c

@@ -114,7 +114,7 @@ trigproc_run_deferred(void)
 			continue;
 
 		if (setjmp(ejbuf)) {
-			error_unwind(ehflag_bombout);
+			pop_error_context(ehflag_bombout);
 			continue;
 		}
 		push_error_handler(&ejbuf, print_error_perpackage, pkg->name);
@@ -122,7 +122,7 @@ trigproc_run_deferred(void)
 		pkg->clientdata->trigprocdeferred = NULL;
 		trigproc(pkg);
 
-		error_unwind(ehflag_normaltidy);
+		pop_error_context(ehflag_normaltidy);
 	}
 }