ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/cvsroot/libeio/eio.c
(Generate patch)

Comparing cvsroot/libeio/eio.c (file contents):
Revision 1.33 by root, Sat Jun 6 19:44:17 2009 UTC vs.
Revision 1.36 by root, Fri Jun 12 00:43:16 2009 UTC

1061 { 1061 {
1062 /* in this case, all is known, and we just put dirs first and sort them */ 1062 /* in this case, all is known, and we just put dirs first and sort them */
1063 eio_dirent *ent = dents + dentoffs; 1063 eio_dirent *ent = dents + dentoffs;
1064 eio_dirent *dir = dents; 1064 eio_dirent *dir = dents;
1065 1065
1066 /* now move dirs to the front, and non-dirs to the back */
1067 /* by walkign from both sides and swapping if necessary */
1066 while (ent > dir) 1068 while (ent > dir)
1067 { 1069 {
1068 if (dir->type == DT_DIR) 1070 if (dir->type == DT_DIR)
1069 ++dir; 1071 ++dir;
1070 else 1072 else
1199 if (ent->type == EIO_DT_UNKNOWN) 1201 if (ent->type == EIO_DT_UNKNOWN)
1200 { 1202 {
1201 if (*name == '.') /* leading dots are likely directories, and, in any case, rare */ 1203 if (*name == '.') /* leading dots are likely directories, and, in any case, rare */
1202 ent->score = 98; 1204 ent->score = 98;
1203 else if (!strchr (name, '.')) /* absense of dots indicate likely dirs */ 1205 else if (!strchr (name, '.')) /* absense of dots indicate likely dirs */
1204 ent->score = len <= 2 ? len + 60 : len <= 4 ? 50 : len <= 7 ? 40 : 10; /* shorter == more likely dir, but avoid too many classes */ 1206 ent->score = len <= 2 ? len + 6 : len <= 4 ? 5 : len <= 7 ? 4 : 1; /* shorter == more likely dir, but avoid too many classes */
1205 } 1207 }
1206 else if (ent->type == EIO_DT_DIR) 1208 else if (ent->type == EIO_DT_DIR)
1207 ent->score = 100; 1209 ent->score = 100;
1208 } 1210 }
1209 } 1211 }
1210 1212
1211 namesoffs += len; 1213 namesoffs += len;
1212 ++dentoffs; 1214 ++dentoffs;
1213 } 1215 }
1216
1217 if (EIO_CANCELLED (req))
1218 {
1219 errno = ECANCELED;
1220 break;
1221 }
1214 } 1222 }
1215 else
1216 req->result = -1;
1217} 1223}
1218 1224
1219#if !(_POSIX_MAPPED_FILES && _POSIX_SYNCHRONIZED_IO) 1225#if !(_POSIX_MAPPED_FILES && _POSIX_SYNCHRONIZED_IO)
1220# undef msync 1226# undef msync
1221# define msync(a,b,c) ((errno = ENOSYS), -1) 1227# define msync(a,b,c) ((errno = ENOSYS), -1)

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines