You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by Brian Behlendorf <br...@hyperreal.com> on 1996/10/08 09:29:54 UTC

cvs commit: apache/src mod_dir.c

brian       96/10/08 00:29:54

  Modified:    src       mod_dir.c
  Log:
  Reviewed by:	brian@organic.com
  Submitted by:	ldl@cs.utah.edu
  
  palloc didn't like being asked for a chunk of size of 0, so we have to
  make sure it doesn't get asked for it.  Since there's nothing to sort
  if num_ent is zero, it doesn't affect the output.
  
  Revision  Changes    Path
  1.12      +23 -21    apache/src/mod_dir.c
  
  Index: mod_dir.c
  ===================================================================
  RCS file: /export/home/cvs/apache/src/mod_dir.c,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -C3 -r1.11 -r1.12
  *** mod_dir.c	1996/08/20 11:51:08	1.11
  --- mod_dir.c	1996/10/08 07:29:52	1.12
  ***************
  *** 50,56 ****
     *
     */
    
  ! /* $Id: mod_dir.c,v 1.11 1996/08/20 11:51:08 paul Exp $ */
    
    /*
     * http_dir.c: Handles the on-the-fly html index generation
  --- 50,56 ----
     *
     */
    
  ! /* $Id: mod_dir.c,v 1.12 1996/10/08 07:29:52 brian Exp $ */
    
    /*
     * http_dir.c: Handles the on-the-fly html index generation
  ***************
  *** 732,763 ****
                num_ent++;
            }
        }
  !     ar=(struct ent **) palloc(r->pool, num_ent*sizeof(struct ent *));
  !     p=head;
  !     x=0;
  !     while(p) {
  !         ar[x++]=p;
  !         p = p->next;
  !     }
        
  !     qsort((void *)ar,num_ent,sizeof(struct ent *),
    #ifdef ULTRIX_BRAIN_DEATH
  !           (int (*))dsortf);
    #else
  !           (int (*)(const void *,const void *))dsortf);
    #endif
  !      output_directories(ar, num_ent, dir_conf, r, dir_opts);
  !      closedir(d);
    
  !      if (dir_opts & FANCY_INDEXING)
  !          if((tmp = find_readme(dir_conf, r)))
  !              insert_readme(name,tmp,1,r);
  !      else {
  !          rputs("</UL>", r);
  !      }
    
  !      rputs("</BODY>", r);
  !      return 0;
    }
    
    /* The formal handler... */
  --- 732,765 ----
                num_ent++;
            }
        }
  !     if (num_ent > 0) {
  !         ar=(struct ent **) palloc(r->pool, num_ent*sizeof(struct ent *));
  !         p=head;
  !         x=0;
  !         while(p) {
  !             ar[x++]=p;
  !             p = p->next;
  !         }
        
  !         qsort((void *)ar,num_ent,sizeof(struct ent *),
    #ifdef ULTRIX_BRAIN_DEATH
  ! 	      (int (*))dsortf);
    #else
  ! 	      (int (*)(const void *,const void *))dsortf);
    #endif
  !     }
  !     output_directories(ar, num_ent, dir_conf, r, dir_opts);
  !     closedir(d);
    
  !     if (dir_opts & FANCY_INDEXING)
  !         if((tmp = find_readme(dir_conf, r)))
  !             insert_readme(name,tmp,1,r);
  !     else {
  !         rputs("</UL>", r);
  !     }
    
  !     rputs("</BODY>", r);
  !     return 0;
    }
    
    /* The formal handler... */