#95 closed defect (fixed)
Name change of p_psScalar
| Reported by: | Owned by: | eugene | |
|---|---|---|---|
| Priority: | high | Milestone: | |
| Component: | IPP SDRS | Version: | unspecified |
| Severity: | normal | Keywords: | |
| Cc: |
Description
SDRS section 4.7 defines the p_psScalar struct as private. I'd like to change
the scope to public and the name to just psScalar. This would be more
consistent with psVector and psImage naming conventions and usage.
I'd also like to change the psScalar allocation function name from:
psScalar(double value)
to
psScalarAlloc(psC64 value , psElemType dataType) All types accecpted
here, but cast to correct psElemType within the function.
Change History (2)
comment:1 by , 22 years ago
| Resolution: | → fixed |
|---|---|
| Status: | new → closed |
comment:2 by , 22 years ago
SDRS has been updated, but behaviour of psUnaryOp and psBinaryOp in rel2 does
not match that specified (i.e., the ps*Op functions are to free any psScalar
argument). Will open a new bug on PSLib (#142).

OK, I agree. But we also need to be careful about the usage. We need to be
sure the rules about freeing psScalars is clear, and I think we need another
function, if the rules are defined as I think they should be defined.
First, the rules. consider this operation:
B = psBinaryOp (NULL, A, "", psScalarAlloc(2));
who frees the resulting psScalarAlloc? The answer must be psBinaryOp, other
wise all reference is lost. Or, we are required to prohibit such lines, and
instead always write:
tmp = psScalarAlloc(2);
B = psBinaryOp (NULL, A, "", tmp);
psFree (tmp);
which somewhat cumbersome. I propose that psBinaryOp and psUnaryOp always free
any psScalar arguments, and if we have a psScalar value we want to keep, we are
required to do:
B = psBinaryOp (NULL, A, "", psScalarCopy(Cval));
So, we need a new function, psScalarCopy which just duplicates the given
psScalar. I've updated the SDRS to reflect this behavior.