Refactor CppHelper.mallocForTarget() to allow specifying the name of the
malloc attribute.
@@ -132,12 +132,17 @@ public class CppHelper {
/**
* Returns the malloc implementation for the given target.
*/
- public static TransitiveInfoCollection mallocForTarget(RuleContext ruleContext) {
+ public static TransitiveInfoCollection mallocForTarget(
+ RuleContext ruleContext, String mallocAttrName) {
if (ruleContext.getFragment(CppConfiguration.class).customMalloc() != null) {
return ruleContext.getPrerequisite(":default_malloc", Mode.TARGET);
} else {
- return ruleContext.getPrerequisite("malloc", Mode.TARGET);
+ return ruleContext.getPrerequisite(mallocAttrName, Mode.TARGET);
+ }
}
+
+ public static TransitiveInfoCollection mallocForTarget(RuleContext ruleContext) {
+ return mallocForTarget(ruleContext, "malloc");
}
/**
