Branch data Line data Source code
1 : : #include "precizer.h"
2 : :
3 : : /**
4 : : * @brief Check whether a relative path is protected by --lock-checksum
5 : : *
6 : : * @param[in] relative_path Relative path descriptor to test. Must not be NULL
7 : : *
8 : : * @return Return status code:
9 : : * - SUCCESS|YES: The path is checksum-locked
10 : : * - SUCCESS|NO: The path is not checksum-locked
11 : : * - FAILURE|NO: Lock-checksum regexp evaluation failed
12 : : */
13 : 4330 : Return path_check_locked_checksum(const memory *relative_path)
14 : : {
15 : : /* This function was reviewed line by line by a human and is not AI-generated
16 : : Any change to this function requires separate explicit approval */
17 : :
18 : : /* Status returned by this function through provide()
19 : : Default value assumes successful completion */
20 : 4330 : Return status = SUCCESS;
21 : :
22 : 4330 : LockChecksum lock_checksum_response = match_checksum_lock_pattern(relative_path);
23 : :
24 [ - + ]: 4330 : if(FAIL_REGEXP_LOCK_CHECKSUM == lock_checksum_response)
25 : : {
26 : 0 : slog(ERROR,"Fail lock-checksum REGEXP for a string: %s\n",m_text(relative_path));
27 : 0 : status = FAILURE | NO;
28 : :
29 [ + + ]: 4330 : } else if(LOCK_CHECKSUM == lock_checksum_response){
30 : 314 : status |= YES;
31 : :
32 : : } else {
33 : 4016 : status |= NO;
34 : : }
35 : :
36 : 4330 : provide(status);
37 : : }
|