httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From c...@hyperreal.org
Subject cvs commit: apache-1.3/src/main http_core.c
Date Thu, 23 Jul 1998 10:46:25 GMT
coar        98/07/23 03:46:25

  Modified:    src/main http_core.c
  Log:
  	Add a comment explaining the initially astonishing use of '!='
  	in what otherwise looks like it should be a string comparison.
  
  Revision  Changes    Path
  1.213     +9 -3      apache-1.3/src/main/http_core.c
  
  Index: http_core.c
  ===================================================================
  RCS file: /export/home/cvs/apache-1.3/src/main/http_core.c,v
  retrieving revision 1.212
  retrieving revision 1.213
  diff -u -r1.212 -r1.213
  --- http_core.c	1998/07/13 11:32:39	1.212
  +++ http_core.c	1998/07/23 10:46:23	1.213
  @@ -1087,12 +1087,18 @@
   static const char *end_nested_section(cmd_parms *cmd, void *dummy)
   {
       if (cmd->end_token == NULL) {
  -	return ap_pstrcat(cmd->pool, cmd->cmd->name,
  -	    " without matching <", cmd->cmd->name + 2, " section", NULL);
  +        return ap_pstrcat(cmd->pool, cmd->cmd->name,
  +			  " without matching <", cmd->cmd->name + 2, 
  +			  " section", NULL);
       }
  +    /*
  +     * This '!=' may look weird on a string comparison, but it's correct --
  +     * it's been set up so that checking for two pointers to the same datum
  +     * is valid here.  And faster.
  +     */
       if (cmd->cmd->name != cmd->end_token) {
   	return ap_pstrcat(cmd->pool, "Expected ", cmd->end_token, " but saw ",
  -	    cmd->cmd->name, NULL);
  +			  cmd->cmd->name, NULL);
       }
       return cmd->end_token;
   }
  
  
  

Mime
View raw message