mirror of
https://github.com/jarun/nnn.git
synced 2024-11-19 01:19:14 +00:00
Offset can be derived
This commit is contained in:
parent
106c7c2371
commit
bc1e74bc56
5
nnn.c
5
nnn.c
|
@ -195,7 +195,6 @@ typedef struct entry {
|
||||||
time_t t;
|
time_t t;
|
||||||
off_t size;
|
off_t size;
|
||||||
blkcnt_t blocks; /* number of 512B blocks allocated */
|
blkcnt_t blocks; /* number of 512B blocks allocated */
|
||||||
size_t noff;
|
|
||||||
mode_t mode;
|
mode_t mode;
|
||||||
} *pEntry;
|
} *pEntry;
|
||||||
|
|
||||||
|
@ -1853,14 +1852,14 @@ dentfill(char *path, struct entry **dents,
|
||||||
/* realloc() may result in memory move, we must re-adjust if that happens */
|
/* realloc() may result in memory move, we must re-adjust if that happens */
|
||||||
if (pnb != pnamebuf)
|
if (pnb != pnamebuf)
|
||||||
for (count = 0; count < n; ++count)
|
for (count = 0; count < n; ++count)
|
||||||
(*dents + count)->name = pnamebuf + (*dents + count)->noff;
|
/* Add file name start offset to new buffer start */
|
||||||
|
(*dents + count)->name = pnamebuf + ((ulong)(*dents + count)->name - (ulong)pnb);
|
||||||
}
|
}
|
||||||
|
|
||||||
dentp = *dents + n;
|
dentp = *dents + n;
|
||||||
|
|
||||||
/* Copy file name */
|
/* Copy file name */
|
||||||
dentp->name = pnamebuf + off;
|
dentp->name = pnamebuf + off;
|
||||||
dentp->noff = off;
|
|
||||||
off += xstrlcpy(dentp->name, namep, NAME_MAX + 1);
|
off += xstrlcpy(dentp->name, namep, NAME_MAX + 1);
|
||||||
|
|
||||||
/* Copy other fields */
|
/* Copy other fields */
|
||||||
|
|
Loading…
Reference in a new issue