diff options
author | Jacques Lucke <jacques@blender.org> | 2021-10-03 15:23:26 +0300 |
---|---|---|
committer | Jacques Lucke <jacques@blender.org> | 2021-10-03 15:23:26 +0300 |
commit | e1e75bd62c33395ca29e4ad456b416f8a6923d46 (patch) | |
tree | ce8c89e6341eee4247f445a76bbecc83c8c2033d /source/blender/blenlib/intern | |
parent | a8d6a86981b3bdcc8e9796a4465544523372c687 (diff) |
Cleanup: move resource scope method definitions out of class
Diffstat (limited to 'source/blender/blenlib/intern')
-rw-r--r-- | source/blender/blenlib/intern/resource_scope.cc | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/source/blender/blenlib/intern/resource_scope.cc b/source/blender/blenlib/intern/resource_scope.cc new file mode 100644 index 00000000000..8c8a03b8ce5 --- /dev/null +++ b/source/blender/blenlib/intern/resource_scope.cc @@ -0,0 +1,32 @@ +/* + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#include "BLI_resource_scope.hh" + +namespace blender { + +ResourceScope::ResourceScope() = default; + +ResourceScope::~ResourceScope() +{ + /* Free in reversed order. */ + for (int64_t i = resources_.size(); i--;) { + ResourceData &data = resources_[i]; + data.free(data.data); + } +} + +} // namespace blender |