patchPSPP - Patches: patch #5683, Add deque implemented as circular...

 
 

You are not allowed to post comments on this tracker with your current authentication level.

patch #5683: Add deque implemented as circular queue to libpspp

Submitter:  Ben Pfaff <blp>
Submitted:  Mon 15 Jan 2007 05:46:28 AM UTC
   
 
Category:  None Item Group:  None
Status:  Done Assigned to:  blp
Open/Closed:  Closed

Tue 16 Jan 2007 12:15:16 AM UTC, comment #2: 

OK, I made your suggested changes, which make sense to me, and checked it in.

Ben Pfaff <blp>
Group administrator
Mon 15 Jan 2007 11:48:03 PM UTC, comment #1: 

I prefer
 assert (condition1);
 assert (condition2);

rather than assert (condition1 && condition2) simply because if the assertion(s) ever fail, the former makes it instantly clear which condition has been violated.  The latter requires extra investigation using the debugger or something.


In NAME##_init, where you have written

 deque->capacity *= 2

I would have put

 deque->capacity <<= 1

I guess any half decent compiler would create the same code, but I think it makes the intent clearer.

John Darrington <jmd>
Group administrator
Mon 15 Jan 2007 05:46:28 AM UTC, original submission:  

The attached patch adds a deque, implemented as a circular queue, to libpspp.  It also demonstrates how to use it by instantiating it  for use as a deque of cases and then uses that "casedeque" to reimplement the LAG functionality for procedures.

It seemed a shame to bog down something as simple and clean as a circular deque in void * pointers and so on, so I used a different approach that's more like a poor man's version of a C++ template.

(I'm planning to use this code as part of a much larger patch, and the effect on LAG is just a nice side effect.)

Ben Pfaff <blp>
Group administrator

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attached Files
file #11748:  deque.patch added by blp (23KiB - text/x-patch - patch)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by jmd (Posted a comment)
  • -email is unavailable- added by blp (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

     

    Follow 5 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2007-01-16 blp StatusWorks For Me Done
        Open/ClosedOpen Closed
    2007-01-15 jmd StatusReady For Test/Review Works For Me
        Assigned tojmd blp
    2007-01-15 blp Attached File- Added deque.patch, #11748

    Back to the top

    Powered by Savane 3.13-4448.
    Corresponding source code