MCPcopy Create free account
hub / github.com/WinMerge/winmerge / Reset

Method Reset

Src/DiffFileData.cpp:96–121  ·  view source on GitHub ↗

@brief Clear inf structure to pristine */

Source from the content-addressed store, hash-verified

94
95/** @brief Clear inf structure to pristine */
96void DiffFileData::Reset()
97{
98 assert(m_inf != nullptr);
99 // If diffutils put data in, have it cleanup
100 if (m_used)
101 {
102 cleanup_file_buffers(m_inf);
103 m_used = false;
104 }
105 // clean up any open file handles, and zero stuff out
106 // open file handles might be leftover from a failure in DiffFileData::OpenFiles
107 if (m_inf[1].desc == m_inf[0].desc)
108 {
109 m_inf[1].desc = 0;
110 }
111 for (int i = 0; i < 2; ++i)
112 {
113 free((void *)m_inf[i].name);
114
115 if (m_inf[i].desc > 0)
116 {
117 cio::close(m_inf[i].desc);
118 }
119 m_inf[i] = {};
120 }
121}
122
123/**
124 * @brief Invoke appropriate plugins for prediffing

Callers 5

RescanMethod · 0.45
TestAllFunction · 0.45
OnEditColumnsMethod · 0.45
ResetFunction · 0.45

Calls 2

assertClass · 0.85
cleanup_file_buffersFunction · 0.85

Tested by 1

TestAllFunction · 0.36