Coalesce - return the first value which is not null. Defaults to null.
| 63 | |
| 64 | // Coalesce - return the first value which is not null. Defaults to null. |
| 65 | SIValue AR_COALESCE(SIValue *argv, int argc, void *private_data) { |
| 66 | for(int i = 0; i < argc; i++) |
| 67 | if(!SIValue_IsNull(argv[i])) { |
| 68 | /* Avoid double free, since the value is propagated and will be free twice: |
| 69 | * 1. Argument array free. |
| 70 | * 2. Record free. */ |
| 71 | SIValue copy = argv[i]; |
| 72 | SIValue_MakeVolatile(argv + i); |
| 73 | return copy; |
| 74 | } |
| 75 | return SI_NullVal(); |
| 76 | } |
| 77 | |
| 78 | // Distinct maintains a set of values, |
| 79 | // if value `X` already in the set return NULL, |
nothing calls this directly
no test coverage detected