Page MenuHomeFreeBSD

Make OF_getprop_alloc API more intuitive
ClosedPublic

Authored by gonzo on Mar 26 2018, 2:23 AM.
Tags
None
Referenced Files
Unknown Object (File)
Thu, May 2, 2:57 PM
Unknown Object (File)
Thu, May 2, 2:57 PM
Unknown Object (File)
Thu, May 2, 1:30 PM
Unknown Object (File)
Thu, May 2, 1:30 PM
Unknown Object (File)
Thu, May 2, 11:36 AM
Unknown Object (File)
Sun, Apr 28, 2:49 PM
Unknown Object (File)
Sat, Apr 27, 12:50 PM
Unknown Object (File)
Dec 23 2023, 10:49 AM
Subscribers

Details

Summary

This is the next stage of OF API clean-up.

OF_getprop_alloc takes element size argument and returns number of elements in
the property. There are valid use cases for such behavior but mostly API
consumers pass 1 as element size to get string properties. What API users would
expect from OF_getprop_alloc is to be a combination of malloc + OF_getprop with
the same semantic of return value. This patch modifies API signature to match
these expectations.

For the valid use cases with element size != 1 and to reduce modification scope
new OF_getprop_calloc function was introduced that behaves the same way
OF_getprop_alloc behaved prior to this patch. The name is tentative
and refers to calloc(3) function. It will be used if better name is
not suggested.

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

Use OF_getprop_alloc_multi name instead of OF_getprop_calloc

This revision is now accepted and ready to land.Apr 8 2018, 3:13 AM
This revision was automatically updated to reflect the committed changes.