comparison src/structs.h @ 9733:59565cdd7261 v7.4.2142

commit https://github.com/vim/vim/commit/8dd3a43d75550e9b5736066124c97697564f769e Author: Bram Moolenaar <Bram@vim.org> Date: Mon Aug 1 20:46:25 2016 +0200 patch 7.4.2142 Problem: Leaking memory when redefining a function. Solution: Don't increment the function reference count when it's found by name. Don't remove the wrong function from the hashtab. More reference counting fixes.
author Christian Brabandt <cb@256bit.org>
date Mon, 01 Aug 2016 21:00:06 +0200
parents 02ba9b2f80e8
children 4cb5ab124239
comparison
equal deleted inserted replaced
9732:fe4bdbd102ea 9733:59565cdd7261
1325 int uf_tml_idx; /* index of line being timed; -1 if none */ 1325 int uf_tml_idx; /* index of line being timed; -1 if none */
1326 int uf_tml_execed; /* line being timed was executed */ 1326 int uf_tml_execed; /* line being timed was executed */
1327 #endif 1327 #endif
1328 scid_T uf_script_ID; /* ID of script where function was defined, 1328 scid_T uf_script_ID; /* ID of script where function was defined,
1329 used for s: variables */ 1329 used for s: variables */
1330 int uf_refcount; /* for numbered function: reference count */ 1330 int uf_refcount; /* reference count, see func_name_refcount() */
1331 funccall_T *uf_scoped; /* l: local variables for closure */ 1331 funccall_T *uf_scoped; /* l: local variables for closure */
1332 char_u uf_name[1]; /* name of function (actually longer); can 1332 char_u uf_name[1]; /* name of function (actually longer); can
1333 start with <SNR>123_ (<SNR> is K_SPECIAL 1333 start with <SNR>123_ (<SNR> is K_SPECIAL
1334 KS_EXTRA KE_SNR) */ 1334 KS_EXTRA KE_SNR) */
1335 } ufunc_T; 1335 } ufunc_T;
1363 proftime_T prof_child; /* time spent in a child */ 1363 proftime_T prof_child; /* time spent in a child */
1364 #endif 1364 #endif
1365 funccall_T *caller; /* calling function or NULL */ 1365 funccall_T *caller; /* calling function or NULL */
1366 1366
1367 /* for closure */ 1367 /* for closure */
1368 int fc_refcount; 1368 int fc_refcount; /* number of user functions that reference this
1369 * funccal */
1369 int fc_copyID; /* for garbage collection */ 1370 int fc_copyID; /* for garbage collection */
1370 garray_T fc_funcs; /* list of ufunc_T* which refer this */ 1371 garray_T fc_funcs; /* list of ufunc_T* which keep a reference to
1372 * "func" */
1371 }; 1373 };
1372 1374
1373 /* 1375 /*
1374 * Struct used by trans_function_name() 1376 * Struct used by trans_function_name()
1375 */ 1377 */