lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


This also works but I still don't know why it should be necessary:

static int aux_close (lua_State *L) {
  LStream *p = tolstream(L);
  lua_CFunction cf = p->closef;
  int rc = (cf)(L);  /* close it */
  p->closef = NULL;  /* mark stream as closed */
  return rc;
}

It seems to be an optimization problem because the original code below
works fine with -O0.

static int aux_close (lua_State *L) {
  LStream *p = tolstream(L);
  lua_CFunction cf = p->closef;
  p->closef = NULL;  /* mark stream as closed */
  return (*cf)(L);  /* close it */
}