Huw Davies : wineps: Move the constraints list to a standard list.

Alexandre Julliard julliard at winehq.org
Wed Apr 11 12:56:46 CDT 2012


Module: wine
Branch: master
Commit: 4dfef2ef2d1743e3f47d59f4ed83c1b41d3d1db7
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=4dfef2ef2d1743e3f47d59f4ed83c1b41d3d1db7

Author: Huw Davies <huw at codeweavers.com>
Date:   Wed Apr 11 12:36:15 2012 +0100

wineps: Move the constraints list to a standard list.

---

 dlls/wineps.drv/ppd.c   |   19 ++++++++-----------
 dlls/wineps.drv/psdrv.h |    7 ++++---
 2 files changed, 12 insertions(+), 14 deletions(-)

diff --git a/dlls/wineps.drv/ppd.c b/dlls/wineps.drv/ppd.c
index 3f2c473..37c6094 100644
--- a/dlls/wineps.drv/ppd.c
+++ b/dlls/wineps.drv/ppd.c
@@ -634,6 +634,7 @@ PPD *PSDRV_ParsePPD(char *fname)
 
     list_init( &ppd->InstalledFonts );
     list_init( &ppd->PageSizes );
+    list_init( &ppd->Constraints );
 
     /*
      *	The Windows PostScript drivers create the following "virtual bin" for
@@ -812,23 +813,19 @@ PPD *PSDRV_ParsePPD(char *fname)
 		  ppd->LandscapeOrientation);
 	}
 
-	else if(!strcmp("*UIConstraints", tuple.key)) {
+        else if(!strcmp("*UIConstraints", tuple.key))
+        {
 	    char *start;
-	    CONSTRAINT *con, **insert = &ppd->Constraints;
-
-	    while(*insert)
-	        insert = &((*insert)->next);
-
-	    con = *insert = HeapAlloc( PSDRV_Heap, HEAP_ZERO_MEMORY,
-				       sizeof(*con) );
+            CONSTRAINT *con = HeapAlloc( PSDRV_Heap, 0, sizeof(*con) );
 
 	    start = tuple.value;
-
 	    con->Feature1 = PSDRV_PPDGetWord(start, &start);
 	    con->Value1 = PSDRV_PPDGetWord(start, &start);
 	    con->Feature2 = PSDRV_PPDGetWord(start, &start);
 	    con->Value2 = PSDRV_PPDGetWord(start, &start);
-	}
+
+            list_add_tail( &ppd->Constraints, &con->entry );
+        }
 
 	else if (!strcmp("*InputSlot", tuple.key))
 	{
@@ -992,7 +989,7 @@ PPD *PSDRV_ParsePPD(char *fname)
 		      page->PaperDimension->x, page->PaperDimension->y);
 	}
 
-	for(con = ppd->Constraints; con; con = con->next)
+        LIST_FOR_EACH_ENTRY( con, &ppd->Constraints, CONSTRAINT, entry )
 	    TRACE("CONSTRAINTS@ %s %s %s %s\n", con->Feature1,
 		  con->Value1, con->Feature2, con->Value2);
 
diff --git a/dlls/wineps.drv/psdrv.h b/dlls/wineps.drv/psdrv.h
index a4ac759..a240f4f 100644
--- a/dlls/wineps.drv/psdrv.h
+++ b/dlls/wineps.drv/psdrv.h
@@ -168,12 +168,13 @@ typedef struct _tagOPTION { /* Treat bool as a special case of pickone */
     struct _tagOPTION		*next;
 } OPTION;
 
-typedef struct _tagCONSTRAINT {
+typedef struct
+{
+    struct list                 entry;
     char			*Feature1;
     char			*Value1;
     char			*Feature2;
     char			*Value2;
-    struct _tagCONSTRAINT	*next;
 } CONSTRAINT;
 
 typedef struct _tagINPUTSLOT {
@@ -218,7 +219,7 @@ typedef struct {
     struct list         PageSizes;
     PAGESIZE            *DefaultPageSize;
     OPTION		*InstalledOptions;
-    CONSTRAINT		*Constraints;
+    struct list         Constraints;
     INPUTSLOT		*InputSlots;
     RASTERIZEROPTION    TTRasterizer;
     DUPLEX              *Duplexes;




More information about the wine-cvs mailing list