[Solved] Distinction between esp_partition_find() and esp_partition_find_first()

User avatar
kolban
Posts: 1683
Joined: Mon Nov 16, 2015 4:43 pm
Location: Texas, USA

[Solved] Distinction between esp_partition_find() and esp_partition_find_first()

Postby kolban » Fri Dec 02, 2016 3:54 am

I'm not following the distinction between esp_partition_find() and esp_partition_find_first(). When would I use one vs the other? What does it mean to create an iterator for partitions that doesn't point to the "first" in the set of possibilities?

Later ... got it ...

esp_partition_find() returns an iterator which can then be used to get the partition and then we dispose of the iterator while esp_partition_find_first() returns the partition and NOT the iterator ... presumably doing the equivalent of a find_first() a get() and an iterator_release() all in a convenience.
Free book on ESP32 available here: https://leanpub.com/kolban-ESP32

ESP_igrr
Posts: 2072
Joined: Tue Dec 01, 2015 8:37 am

Re: Distinction between esp_partition_find() and esp_partition_find_first()

Postby ESP_igrr » Fri Dec 02, 2016 4:00 am

Find returns an iterator (which references the first partition that meets criteria). Find_first returns a pointer to the partition structure for the first partition which meets criteria, or NULL if such partition does not exist. It is a shorthand for 'find' followed by 'get'. It is intended to be used when you don't plan to iterate multiple partitions, and expect to find one and only partition of a specific type.

Who is online

Users browsing this forum: No registered users and 156 guests