<p>Patrick Rudolph has uploaded this change for <strong>review</strong>.</p><p><a href="https://review.coreboot.org/25447">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">include/string: Add strrchr<br><br>Copy strrchr from libpayload.<br>To be used by Cavium's BDK or FDT parsers.<br><br>Change-Id: Iab7981c25113ed16f1b8130de4935d30c29d2fa5<br>Signed-off-by: Patrick Rudolph <patrick.rudolph@9elements.com><br>---<br>M src/include/string.h<br>1 file changed, 20 insertions(+), 0 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://review.coreboot.org:29418/coreboot refs/changes/47/25447/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/src/include/string.h b/src/include/string.h</span><br><span>index 7597323..d2d7bb8 100644</span><br><span>--- a/src/include/string.h</span><br><span>+++ b/src/include/string.h</span><br><span>@@ -66,6 +66,26 @@</span><br><span> }</span><br><span> #endif</span><br><span> </span><br><span style="color: hsl(120, 100%, 40%);">+/**</span><br><span style="color: hsl(120, 100%, 40%);">+ * Find a character in a string.</span><br><span style="color: hsl(120, 100%, 40%);">+ *</span><br><span style="color: hsl(120, 100%, 40%);">+ * @param s The string.</span><br><span style="color: hsl(120, 100%, 40%);">+ * @param c The character.</span><br><span style="color: hsl(120, 100%, 40%);">+ * @return A pointer to the last occurrence of the character in the</span><br><span style="color: hsl(120, 100%, 40%);">+ * string, or NULL if the character was not encountered within the string.</span><br><span style="color: hsl(120, 100%, 40%);">+ */</span><br><span style="color: hsl(120, 100%, 40%);">+static inline char *strrchr(const char *s, int c)</span><br><span style="color: hsl(120, 100%, 40%);">+{</span><br><span style="color: hsl(120, 100%, 40%);">+    char *p = (char *)s + strlen(s);</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+    for (; p >= s; p--) {</span><br><span style="color: hsl(120, 100%, 40%);">+              if (*p == c)</span><br><span style="color: hsl(120, 100%, 40%);">+                  return p;</span><br><span style="color: hsl(120, 100%, 40%);">+     }</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+   return NULL;</span><br><span style="color: hsl(120, 100%, 40%);">+}</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span> static inline char *strncpy(char *to, const char *from, int count)</span><br><span> {</span><br><span>         register char *ret = to;</span><br><span></span><br></pre><p>To view, visit <a href="https://review.coreboot.org/25447">change 25447</a>. To unsubscribe, or for help writing mail filters, visit <a href="https://review.coreboot.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://review.coreboot.org/25447"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: coreboot </div>
<div style="display:none"> Gerrit-Branch: master </div>
<div style="display:none"> Gerrit-MessageType: newchange </div>
<div style="display:none"> Gerrit-Change-Id: Iab7981c25113ed16f1b8130de4935d30c29d2fa5 </div>
<div style="display:none"> Gerrit-Change-Number: 25447 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: Patrick Rudolph <patrick.rudolph@9elements.com> </div>