On Mon, 4 Feb 2013, Gleb Smirnoff wrote:

  any additional comments for the attached patch. Is it ok from your
viewpoint?

Index: queue.h
===================================================================
--- queue.h     (revision 245741)
+++ queue.h     (working copy)
@@ -105,13 +105,14 @@
 #ifdef QUEUE_MACRO_DEBUG
 /* Store the last 2 places the queue element or head was altered */
 struct qm_trace {
-       char * lastfile;
-       int lastline;
-       char * prevfile;
-       int prevline;
+       const char * lastfile;
+       unsigned long lastline;
+       const char * prevfile;
+       unsigned long prevline;
 };

Unsigned long is unnecessarily large.  It wastes space on 64-bit
arches.  The change doesn't change the wastage, because space was
already wasted on 64-bit arches by mispacking the struct (with
unnamed padding after the ints).  It changes the API unnecessarily
by changing signed variables to unsigned.  Sign variables are
easier to use, and changing to unsigned ones risks sign extension
bugs.

According to your quote of the C standard, int32_t is enough.  (I
couldn't find anything directly about either the type or limit of
__LINE__ in the n869.txt draft of C99, but #line is limited to 2**31-1.
n1124.pdf says much the same, except it says that __LINE__ is an integer
constant where n869.txt says that __LINE__ is a decimal constant.  Both
of these seem to be wrong -- "decimal constants" include floating point
ones, and "integer constants" include octal and hex ones.)

The change preserves many style bugs:
- no prefix in member names
- member names not sorted inversely on size.  This gives the space
  wastage.
- member names not indented
- space between '*' and member names.

Bruce
_______________________________________________
freebsd-bugs@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-bugs
To unsubscribe, send any mail to "freebsd-bugs-unsubscr...@freebsd.org"

Reply via email to