+ Ways *ways The ways structure to use.
+
+ index_t index The index of the way.
+
+ int position The position in the cache to store the value.
+ ++++++++++++++++++++++++++++++++++++++*/
+
+static inline Way *LookupWay(Ways *ways,index_t index,int position)
+{
+ SeekFile(ways->fd,sizeof(WaysFile)+(off_t)index*sizeof(Way));
+
+ ReadFile(ways->fd,&ways->wcached[position-1],sizeof(Way));
+
+ return(&ways->wcached[position-1]);
+}
+
+
+/*++++++++++++++++++++++++++++++++++++++
+ Find the name of a way.
+
+ char *WayName Returns a pointer to the name of the way.
+
+ Ways *ways The ways structure to use.
+
+ Way *way The Way pointer.
+ ++++++++++++++++++++++++++++++++++++++*/
+
+static inline char *WayName(Ways *ways,Way *way)
+{
+ int n=0;
+
+ if(way->name==ways->nincache)
+ return(ways->ncached);
+
+ SeekFile(ways->fd,ways->namesoffset+way->name);
+
+ if(!ways->ncached)
+ ways->ncached=(char*)malloc(32);
+
+ while(1)
+ {
+ int i;
+ int m=ReadFile(ways->fd,ways->ncached+n,32);
+
+ if(m<0)
+ break;
+
+ for(i=n;i<n+32;i++)
+ if(ways->ncached[i]==0)
+ goto exitloop;
+
+ n+=32;
+
+ ways->ncached=(char*)realloc((void*)ways->ncached,n+32);
+ }
+
+ exitloop:
+
+ return(ways->ncached);
+}
+
+#endif