Skip to content

Commit e74fb66

Browse files
danolivomason-sharp
authored andcommitted
Replace memcpy with structure assignment in apply_worker_get_progress
Use direct structure assignment instead of memcpy for copying SpockApplyProgress. This is more idiomatic, type-safe, and resolves static analyzer warnings about buffer size validation. The compiler generates identical code while providing compile-time type checking and better code clarity.
1 parent c231d4a commit e74fb66

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

src/spock_group.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -407,9 +407,7 @@ apply_worker_get_progress(void)
407407
if (MyApplyWorker && MyApplyWorker->apply_group)
408408
{
409409
LWLockAcquire(SpockCtx->apply_group_master_lock, LW_SHARED);
410-
411-
memcpy(&sap, &MyApplyWorker->apply_group->progress,
412-
sizeof(SpockApplyProgress));
410+
sap = MyApplyWorker->apply_group->progress;
413411
LWLockRelease(SpockCtx->apply_group_master_lock);
414412
}
415413
else

0 commit comments

Comments
 (0)