[Expat-checkins] expat/lib xmltok.c,1.11,1.12

fdrake@users.sourceforge.net fdrake@users.sourceforge.net
Fri May 17 11:48:02 2002


Update of /cvsroot/expat/expat/lib
In directory usw-pr-cvs1:/tmp/cvs-serv7136/lib

Modified Files:
	xmltok.c 
Log Message:
Using "0" instead of "NULL" is insane, and leads to unmaintainable code.
Fix a number of other "code-hygiene" consistency nits.


Index: xmltok.c
===================================================================
RCS file: /cvsroot/expat/expat/lib/xmltok.c,v
retrieving revision 1.11
retrieving revision 1.12
diff -C2 -d -r1.11 -r1.12
*** xmltok.c	17 May 2002 18:17:33 -0000	1.11
--- xmltok.c	17 May 2002 18:47:53 -0000	1.12
***************
*** 1,5 ****
! /*
! Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd
! See the file COPYING for copying permission.
  */
  
--- 1,4 ----
! /* Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd
!    See the file COPYING for copying permission.
  */
  
***************
*** 38,45 ****
     (namingBitmap[(pages[hi] << 3) + ((lo) >> 5)] & (1 << ((lo) & 0x1F)))
  
! /* A 2 byte UTF-8 representation splits the characters 11 bits
! between the bottom 5 and 6 bits of the bytes.
! We need 8 bits to index into pages, 3 bits to add to that index and
! 5 bits to generate the mask. */
  #define UTF8_GET_NAMING2(pages, byte) \
      (namingBitmap[((pages)[(((byte)[0]) >> 2) & 7] << 3) \
--- 37,44 ----
     (namingBitmap[(pages[hi] << 3) + ((lo) >> 5)] & (1 << ((lo) & 0x1F)))
  
! /* A 2 byte UTF-8 representation splits the characters 11 bits between
!    the bottom 5 and 6 bits of the bytes.  We need 8 bits to index into
!    pages, 3 bits to add to that index and 5 bits to generate the mask.
! */
  #define UTF8_GET_NAMING2(pages, byte) \
      (namingBitmap[((pages)[(((byte)[0]) >> 2) & 7] << 3) \
***************
*** 48,55 ****
           & (1 << (((byte)[1]) & 0x1F)))
  
! /* A 3 byte UTF-8 representation splits the characters 16 bits
! between the bottom 4, 6 and 6 bits of the bytes.
! We need 8 bits to index into pages, 3 bits to add to that index and
! 5 bits to generate the mask. */
  #define UTF8_GET_NAMING3(pages, byte) \
    (namingBitmap[((pages)[((((byte)[0]) & 0xF) << 4) \
--- 47,55 ----
           & (1 << (((byte)[1]) & 0x1F)))
  
! /* A 3 byte UTF-8 representation splits the characters 16 bits between
!    the bottom 4, 6 and 6 bits of the bytes.  We need 8 bits to index
!    into pages, 3 bits to add to that index and 5 bits to generate the
!    mask.
! */
  #define UTF8_GET_NAMING3(pages, byte) \
    (namingBitmap[((pages)[((((byte)[0]) & 0xF) << 4) \
***************
*** 482,487 ****
  static void \
  E ## toUtf8(const ENCODING *enc, \
! 		 const char **fromP, const char *fromLim, \
! 		 char **toP, const char *toLim) \
  { \
    const char *from; \
--- 482,487 ----
  static void \
  E ## toUtf8(const ENCODING *enc, \
! 	    const char **fromP, const char *fromLim, \
! 	    char **toP, const char *toLim) \
  { \
    const char *from; \
***************
*** 545,550 ****
  static void \
  E ## toUtf16(const ENCODING *enc, \
! 		  const char **fromP, const char *fromLim, \
! 		  unsigned short **toP, const unsigned short *toLim) \
  { \
    /* Avoid copying first half only of surrogate */ \
--- 545,550 ----
  static void \
  E ## toUtf16(const ENCODING *enc, \
! 	     const char **fromP, const char *fromLim, \
! 	     unsigned short **toP, const unsigned short *toLim) \
  { \
    /* Avoid copying first half only of surrogate */ \
***************
*** 909,914 ****
  }
  
! /* Return 1 if there's just optional white space
! or there's an S followed by name=val. */
  static int
  parsePseudoAttribute(const ENCODING *enc,
--- 909,915 ----
  }
  
! /* Return 1 if there's just optional white space or there's an S
!    followed by name=val.
! */
  static int
  parsePseudoAttribute(const ENCODING *enc,
***************
*** 923,927 ****
    char open;
    if (ptr == end) {
!     *namePtr = 0;
      return 1;
    }
--- 924,928 ----
    char open;
    if (ptr == end) {
!     *namePtr = NULL;
      return 1;
    }
***************
*** 934,938 ****
    } while (isSpace(toAscii(enc, ptr, end)));
    if (ptr == end) {
!     *namePtr = 0;
      return 1;
    }
--- 935,939 ----
    } while (isSpace(toAscii(enc, ptr, end)));
    if (ptr == end) {
!     *namePtr = NULL;
      return 1;
    }
***************
*** 1032,1038 ****
  	       int *standalone)
  {
!   const char *val = 0;
!   const char *name = 0;
!   const char *nameEnd = 0;
    ptr += 5 * enc->minBytesPerChar;
    end -= 2 * enc->minBytesPerChar;
--- 1033,1039 ----
  	       int *standalone)
  {
!   const char *val = NULL;
!   const char *name = NULL;
!   const char *nameEnd = NULL;
    ptr += 5 * enc->minBytesPerChar;
    end -= 2 * enc->minBytesPerChar;
***************
*** 1408,1412 ****
    };
    int i;
!   if (name == 0)
      return NO_ENC;
    for (i = 0; i < (int)(sizeof(encodingNames)/sizeof(encodingNames[0])); i++)
--- 1409,1413 ----
    };
    int i;
!   if (name == NULL)
      return NO_ENC;
    for (i = 0; i < (int)(sizeof(encodingNames)/sizeof(encodingNames[0])); i++)
***************
*** 1502,1506 ****
           and this is an external text entity,
  	 don't look for the BOM,
!          because it might be a legal data. */
        if (state == XML_CONTENT_STATE) {
  	int e = INIT_ENC_INDEX(enc);
--- 1503,1508 ----
           and this is an external text entity,
  	 don't look for the BOM,
!          because it might be a legal data.
!       */
        if (state == XML_CONTENT_STATE) {
  	int e = INIT_ENC_INDEX(enc);
***************
*** 1538,1542 ****
  	   by assuming UTF-16LE.  But we don't, because this would mean when
  	   presented just with a single byte, we couldn't reliably determine
! 	   whether we needed further bytes. */
  	if (state == XML_CONTENT_STATE)
  	  break;
--- 1540,1545 ----
  	   by assuming UTF-16LE.  But we don't, because this would mean when
  	   presented just with a single byte, we couldn't reliably determine
! 	   whether we needed further bytes.
!         */
  	if (state == XML_CONTENT_STATE)
  	  break;