File tree Expand file tree Collapse file tree 1 file changed +16
-7
lines changed Expand file tree Collapse file tree 1 file changed +16
-7
lines changed Original file line number Diff line number Diff line change @@ -138,17 +138,26 @@ function readmeta(io::IO)
138
138
error (replace (msg, " \n " => " " ))
139
139
end
140
140
141
- """
142
- readmeta(path::AbstractStriong)
143
-
144
- Read an Object File out from a file `path`, guessing at the type of object
145
- within the stream by calling `readmeta(io, T)` for each `T` within `ObjTypes`,
146
- and returning the first that does not throw a `MagicMismatch`.
147
- """
148
141
function readmeta (file:: AbstractString )
142
+ depwarn (" `readmeta(file::AbstractString)` is deprecated, use the do-block variant instead." )
149
143
return readmeta (open (file, " r" ))
150
144
end
151
145
146
+ """
147
+ readmeta(f::Function, file::AbstractString)
148
+
149
+ Do-block variant of `readmeta()`. Use via something like:
150
+
151
+ readmeta("libfoo.so") do f
152
+ ...
153
+ end
154
+ """
155
+ function readmeta (f:: Function , file:: AbstractString )
156
+ io = open (file, " r" )
157
+ ret = f (readmeta (io))
158
+ close (io)
159
+ return ret
160
+ end
152
161
153
162
154
163
# # IOStream-like operations
You can’t perform that action at this time.
0 commit comments