Optimize res_find().
When the device name is provided, we can simply run strncmp() for each
line to quickly skip unrelated ones, that is much faster than sscanf()
and only then strcmp().
MFC after: 2 weeks
(cherry picked from commit 696fca3fd491972e615195f2ce94598b9c469cac)