From: andy Date: Thu, 15 Mar 2001 19:26:23 +0000 (+0000) Subject: Store next pointer before removing printer from class, since the class X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=a3ad20c9dcad1447c594ba6fbe3d24c4aa6be900;p=thirdparty%2Fcups.git Store next pointer before removing printer from class, since the class might be removed... git-svn-id: svn+ssh://src.apple.com/svn/cups/cups.org/trunk@1634 7a7537e8-13f0-0310-91df-b6672ffda945 --- diff --git a/scheduler/classes.c b/scheduler/classes.c index 8060711ae3..eaab1ebe69 100644 --- a/scheduler/classes.c +++ b/scheduler/classes.c @@ -1,5 +1,5 @@ /* - * "$Id: classes.c,v 1.32 2001/02/09 18:40:34 mike Exp $" + * "$Id: classes.c,v 1.33 2001/03/15 19:26:22 andy Exp $" * * Printer class routines for the Common UNIX Printing System (CUPS). * @@ -201,7 +201,9 @@ DeletePrinterFromClass(printer_t *c, /* I - Class to delete from */ void DeletePrinterFromClasses(printer_t *p) /* I - Printer to delete */ { - printer_t *c; /* Pointer to current class */ + printer_t *c, /* Pointer to current class */ + *prev, + *next; /* Pointer to next class */ /* @@ -209,9 +211,13 @@ DeletePrinterFromClasses(printer_t *p) /* I - Printer to delete */ * from each class listed... */ - for (c = Printers; c != NULL; c = c->next) + for (c = Printers, prev = NULL; c != NULL; prev = c, c = next) + { + next = c->next; + if (c->type & (CUPS_PRINTER_CLASS | CUPS_PRINTER_IMPLICIT)) DeletePrinterFromClass(c, p); + } } @@ -619,5 +625,5 @@ SaveAllClasses(void) /* - * End of "$Id: classes.c,v 1.32 2001/02/09 18:40:34 mike Exp $". + * End of "$Id: classes.c,v 1.33 2001/03/15 19:26:22 andy Exp $". */ diff --git a/scheduler/printers.c b/scheduler/printers.c index ec4a474bd1..b20f926cce 100644 --- a/scheduler/printers.c +++ b/scheduler/printers.c @@ -1,5 +1,5 @@ /* - * "$Id: printers.c,v 1.90 2001/03/14 13:45:35 mike Exp $" + * "$Id: printers.c,v 1.91 2001/03/15 19:26:23 andy Exp $" * * Printer routines for the Common UNIX Printing System (CUPS). * @@ -297,7 +297,6 @@ DeletePrinter(printer_t *p) /* I - Printer to delete */ else prev->next = p->next; - /* * Stop printing on this printer... */ @@ -1782,5 +1781,5 @@ write_printcap(void) /* - * End of "$Id: printers.c,v 1.90 2001/03/14 13:45:35 mike Exp $". + * End of "$Id: printers.c,v 1.91 2001/03/15 19:26:23 andy Exp $". */