Skip to content

Commit 0d7de08

Browse files
committed
unix: Change define logic of _DIRENT_HAVE_D_INO to match other macros.
1 parent 64a909e commit 0d7de08

3 files changed

Lines changed: 7 additions & 2 deletions

File tree

unix/modos.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ STATIC mp_obj_t listdir_next(mp_obj_t self_in) {
184184
// DT_UNKNOWN should have 0 value on any reasonable system
185185
t->items[1] = MP_OBJ_NEW_SMALL_INT(0);
186186
#endif
187-
#if !defined(_DIRENT_HAVE_D_INO) || _DIRENT_HAVE_D_INO
187+
#ifdef _DIRENT_HAVE_D_INO
188188
t->items[2] = MP_OBJ_NEW_SMALL_INT(dirent->d_ino);
189189
#else
190190
t->items[2] = MP_OBJ_NEW_SMALL_INT(0);

unix/mpconfigport.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -259,3 +259,8 @@ extern const struct _mp_obj_fun_builtin_t mp_builtin_open_obj;
259259
#ifndef _DIRENT_HAVE_D_TYPE
260260
#define _DIRENT_HAVE_D_TYPE (1)
261261
#endif
262+
// This macro is not provided by glibc but we need it so ports that don't have
263+
// dirent->d_ino can disable the use of this field.
264+
#ifndef _DIRENT_HAVE_D_INO
265+
#define _DIRENT_HAVE_D_INO (1)
266+
#endif

unix/mpconfigport_freedos.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,4 +35,4 @@
3535
#define MICROPY_PY_SYS_PLATFORM "freedos"
3636

3737
// djgpp dirent struct does not have d_ino field
38-
#define _DIRENT_HAVE_D_INO (0)
38+
#undef _DIRENT_HAVE_D_INO

0 commit comments

Comments
 (0)