Browse code

core: pvapi - reinitialize _pv_print_buffer_index when adjusting the slots

- GH #2798

(cherry picked from commit 61cbb5e861aeb9b7f69ebb8d284e3ded0ede9cd8)
(cherry picked from commit 75571e1739470877365e7c25548ef282e81283a1)
(cherry picked from commit f5c81022fdc769f306cf720bece29f1d265bfe61)

Daniel-Constantin Mierla authored on 27/07/2021 14:52:12 • Henning Westerholt committed on 22/10/2021 12:03:20
Showing 1 changed files
... ...
@@ -2140,6 +2140,7 @@ int pv_init_buffer(void)
2140 2140
 			_pv_print_buffer_slots, _pv_print_buffer_size);
2141 2141
 	_pv_print_buffer_slots_active = _pv_print_buffer_slots;
2142 2142
 	_pv_print_buffer_size_active = _pv_print_buffer_size;
2143
+	_pv_print_buffer_index = 0;
2143 2144
 
2144 2145
 	return 0;
2145 2146
 }
... ...
@@ -2161,6 +2162,7 @@ void pv_destroy_buffer(void)
2161 2162
 	pkg_free(_pv_print_buffer);
2162 2163
 	_pv_print_buffer_slots_active = 0;
2163 2164
 	_pv_print_buffer_size_active = 0;
2165
+	_pv_print_buffer_index = 0;
2164 2166
 	_pv_print_buffer = NULL;
2165 2167
 }
2166 2168
 
... ...
@@ -2170,8 +2172,9 @@ void pv_destroy_buffer(void)
2170 2172
 int pv_reinit_buffer(void)
2171 2173
 {
2172 2174
 	if(_pv_print_buffer_size==_pv_print_buffer_size_active
2173
-			&& _pv_print_buffer_slots==_pv_print_buffer_slots_active)
2175
+			&& _pv_print_buffer_slots==_pv_print_buffer_slots_active) {
2174 2176
 		return 0;
2177
+	}
2175 2178
 	pv_destroy_buffer();
2176 2179
 	return pv_init_buffer();
2177 2180
 }