?

Log in

No account? Create an account

fanf

DJB / cdb

« previous entry | next entry »
3rd Jul 2006 | 21:56

I've been playing around with Dan Bernstien's cdb recently. We use it quite heavily - most of the configuration tables on our mail servers are cdb files. I'm quite fond of its simplicity. But the code... DJB doesn't really do layers of abstraction. (He even says "Packages that need to read cdb files should incorporate the necessary portions of the cdb library rather than relying on an external cdb library.") He also doesn't believe in libc: the cdb code includes an incorrect declaration for errno, a braindead wrapper around malloc(), inefficient string functions, a dumb reinvented wheel strerror(), etc. etc. When I was reading the algorithm that constructs the hash tables, I added comments as I went. One of them said:
  /* Afterwards c->start[i] points to the *end* of the ith block. */
Nice variable name!

(Admittedly the next loop adjusts the pointers so that the name becomes correct, but still.)

| Leave a comment | Share

Comments {0}