Use lgi.GLib.String():append(tb):hash()

This commit is contained in:
Daniel Hahler 2015-02-10 00:59:15 +01:00
parent 8df51d0b8c
commit 0a76e41cb8
1 changed files with 5 additions and 4 deletions

View File

@ -17,6 +17,7 @@ local type = type
local rtable = table local rtable = table
local pairs = pairs local pairs = pairs
local string = string local string = string
local glib = require("lgi").GLib
local capi = local capi =
{ {
awesome = awesome, awesome = awesome,
@ -35,16 +36,16 @@ local displayed_deprecations = {}
-- @param see Optional message to a new method / function to use. -- @param see Optional message to a new method / function to use.
function util.deprecate(see) function util.deprecate(see)
local tb = debug.traceback() local tb = debug.traceback()
if util.table.hasitem(displayed_deprecations, tb) then local tbhash = glib.String():append(tb):hash()
if displayed_deprecations[tbhash] then
return return
end end
table.insert(displayed_deprecations, tb) displayed_deprecations[tbhash] = true
io.stderr:write("W: awful: function is deprecated") io.stderr:write("W: awful: function is deprecated")
if see then if see then
io.stderr:write(", see " .. see) io.stderr:write(", see " .. see)
end end
io.stderr:write("\n") io.stderr:write("\n" .. tb .. "\n")
io.stderr:write(tb)
end end
--- Strip alpha part of color. --- Strip alpha part of color.