Use a name argument, for the same reasons as 6eea5f70e3. Also reuse the layer and unique name creation in `BKE_id_attribute_new` instead of reimplementing it. Also include a few miscellaneous cleanups like using const variables and `std::string`.
6eea5f70e3