Skip to content

Commit

Permalink
format code
Browse files Browse the repository at this point in the history
  • Loading branch information
fesily committed Nov 2, 2024
1 parent 8e0975c commit 353ca79
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 16 deletions.
13 changes: 6 additions & 7 deletions src/luadebug/compat/5x/callinfo.cpp
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
#include "compat/internal.h"

#include <lstate.h>
#include <ldebug.h>
#include <lstate.h>

#include "compat/internal.h"

#if LUA_VERSION_NUM >= 504
# define LUA_STKID(s) s.p
Expand Down Expand Up @@ -56,9 +55,9 @@ static int currentpc(lua_State* L, CallInfo* ci) {
}

#else
#ifndef ci_func
#define ci_func(ci) (clLvalue((ci)->func))
#endif
# ifndef ci_func
# define ci_func(ci) (clLvalue((ci)->func))
# endif
static int currentpc(CallInfo* ci) {
lua_assert(isLua(ci));
return pcRel(ci->u.l.savedpc, ci_func(ci)->p);
Expand All @@ -82,5 +81,5 @@ const Instruction* lua_getsavedpc(lua_State* L, CallInfo* ci) {
return ci->savedpc;
#else
return ci->u.l.savedpc;
#endif
#endif
}
8 changes: 4 additions & 4 deletions src/luadebug/compat/jit/callinfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ static cTValue* debug_frame(lua_State* L, int level, int* size) {

#define NO_BCPOS (~(BCPos)0)
static const BCIns* debug_frameins(lua_State* L, GCfunc* fn, cTValue* nextframe) {
const BCIns* ins;
const BCIns* ins;
lj_assertL(fn->c.gct == ~LJ_TFUNC || fn->c.gct == ~LJ_TTHREAD, "function or frame expected");
if (!isluafunc(fn)) { /* Cannot derive a PC for non-Lua functions. */
return nullptr;
Expand Down Expand Up @@ -82,7 +82,7 @@ static const BCIns* debug_frameins(lua_State* L, GCfunc* fn, cTValue* nextframe)
/* Return bytecode position for function/frame or NO_BCPOS. */
static BCPos debug_framepc(lua_State* L, GCfunc* fn, cTValue* nextframe) {
const BCIns* ins = debug_frameins(L, fn, nextframe);
GCproto *pt;
GCproto* pt;
BCPos pos;
if (!ins) return NO_BCPOS;
pt = funcproto(fn);
Expand Down Expand Up @@ -128,9 +128,9 @@ int lua_isluafunc(lua_State* L, lua_Debug* ar) {
}

int lua_getcurrentpc(lua_State* L, CallInfo* ci) {
return debug_framepc(L, frame_func(ci), ci);
return debug_framepc(L, frame_func(ci), ci);
}

const Instruction* lua_getsavedpc(lua_State* L, CallInfo* ci) {
return debug_frameins(L, frame_func(ci), ci);
return debug_frameins(L, frame_func(ci), ci);
}
4 changes: 2 additions & 2 deletions src/luadebug/rdebug_visitor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -801,7 +801,7 @@ namespace luadebug::visitor {
frame = area.checkinteger<int>(L, 1);
if (lua_getstack(hL, frame, &ar) == 0)
return 0;
std::array<char, 8> what{};
std::array<char, 8> what {};
auto sz = std::min(what.size() - 1, options.size());
std::copy_if(options.cbegin(), options.cbegin() + sz, what.begin(), [](auto c) { return c != 'p' && c != 'P'; });
if (lua_getinfo(hL, what.data(), &ar) == 0)
Expand All @@ -824,7 +824,7 @@ namespace luadebug::visitor {
if (flags.test('f') || flags.test('p') || flags.test('P')) {
return area.raise_error("invalid option");
}
std::array<char, 8> what{};
std::array<char, 8> what {};
what[0] = '>';
auto sz = std::min(what.size() - 2, options.size());
std::copy_if(options.cbegin(), options.cbegin() + sz, what.begin() + 1, [](auto c) { return c != 'p' && c != 'P'; });
Expand Down
7 changes: 4 additions & 3 deletions src/luadebug/rdebug_win32.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,14 @@

# include <Windows.h>
# include <stdint.h>

# include <string>

namespace luadebug::win32 {
typedef FARPROC (*FindLuaApi)(const char* name);
static HMODULE luadll = 0;
static FindLuaApi luaapi = 0;
static bool debugSelf = false;
static bool debugSelf = false;

HMODULE get_luadll() {
return luadll;
Expand All @@ -32,8 +33,8 @@ namespace luadebug::win32 {
// set lua dll self
caller_is_luadll(&set_luaapi);
// set lua api finder
luaapi = +[](const char* name){
auto n = "luadbg" + std::string{name}.substr(3);
luaapi = +[](const char* name) {
auto n = "luadbg" + std::string { name }.substr(3);
return ::GetProcAddress(luadll, n.c_str());
};
}
Expand Down

0 comments on commit 353ca79

Please sign in to comment.