0001-src-lreq.c-fix-build-with-gcc-4.8.patch 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. From d05134115ec8fcfc87188899cec336a8b4df7e62 Mon Sep 17 00:00:00 2001
  2. From: Fabrice Fontaine <fontaine.fabrice@gmail.com>
  3. Date: Sat, 22 Feb 2020 22:17:19 +0100
  4. Subject: [PATCH] src/lreq.c: fix build with gcc 4.8
  5. Since commit 3e34390cc15101d7fc46ea26f5adf9ac022c2029, build fails with
  6. gcc 4.8.3 on:
  7. In file included from /usr/lfs/hdd_v1/rc-buildroot-test/scripts/instance-0/output/build/luv-1.34.1-1/src/luv.c:27:0:
  8. /usr/lfs/hdd_v1/rc-buildroot-test/scripts/instance-0/output/build/luv-1.34.1-1/src/lreq.c: In function 'luv_cleanup_req':
  9. /usr/lfs/hdd_v1/rc-buildroot-test/scripts/instance-0/output/build/luv-1.34.1-1/src/lreq.c:70:5: error: 'for' loop initial declarations are only allowed in C99 mode
  10. for (int i = 0; ((int*)(data->data))[i] != LUA_NOREF; i++) {
  11. ^
  12. Fixes:
  13. - http://autobuild.buildroot.org/results/83b34e606b128546da8a70836d039090e334a1ec
  14. Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
  15. [Accepted status: https://github.com/luvit/luv/pull/456]
  16. ---
  17. src/lreq.c | 3 ++-
  18. 1 file changed, 2 insertions(+), 1 deletion(-)
  19. diff --git a/src/lreq.c b/src/lreq.c
  20. index c8e07eb..b12ec4f 100644
  21. --- a/src/lreq.c
  22. +++ b/src/lreq.c
  23. @@ -64,10 +64,11 @@ static void luv_fulfill_req(lua_State* L, luv_req_t* data, int nargs) {
  24. }
  25. static void luv_cleanup_req(lua_State* L, luv_req_t* data) {
  26. + int i;
  27. luaL_unref(L, LUA_REGISTRYINDEX, data->req_ref);
  28. luaL_unref(L, LUA_REGISTRYINDEX, data->callback_ref);
  29. if (data->data_ref == LUV_REQ_MULTIREF) {
  30. - for (int i = 0; ((int*)(data->data))[i] != LUA_NOREF; i++) {
  31. + for (i = 0; ((int*)(data->data))[i] != LUA_NOREF; i++) {
  32. luaL_unref(L, LUA_REGISTRYINDEX, ((int*)(data->data))[i]);
  33. }
  34. }
  35. --
  36. 2.25.0