OLD | NEW |
1 /* | 1 /* |
2 Samba Unix SMB/CIFS implementation. | 2 Samba Unix SMB/CIFS implementation. |
3 | 3 |
4 Samba trivial allocation library - new interface | 4 Samba trivial allocation library - new interface |
5 | 5 |
6 NOTE: Please read talloc_guide.txt for full documentation | 6 NOTE: Please read talloc_guide.txt for full documentation |
7 | 7 |
8 Copyright (C) Andrew Tridgell 2004 | 8 Copyright (C) Andrew Tridgell 2004 |
9 Copyright (C) Stefan Metzmacher 2006 | 9 Copyright (C) Stefan Metzmacher 2006 |
10 | 10 |
(...skipping 1576 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1587 /* | 1587 /* |
1588 strdup with a talloc | 1588 strdup with a talloc |
1589 */ | 1589 */ |
1590 char *talloc_strdup(const void *t, const char *p) | 1590 char *talloc_strdup(const void *t, const char *p) |
1591 { | 1591 { |
1592 if (unlikely(!p)) return NULL; | 1592 if (unlikely(!p)) return NULL; |
1593 return __talloc_strlendup(t, p, strlen(p)); | 1593 return __talloc_strlendup(t, p, strlen(p)); |
1594 } | 1594 } |
1595 | 1595 |
1596 #ifndef HAVE_STRNLEN | 1596 #ifndef HAVE_STRNLEN |
1597 static size_t strnlen(const char* s, size_t n) | 1597 #define strnlen rep_strnlen |
| 1598 static size_t rep_strnlen(const char* s, size_t n) |
1598 { | 1599 { |
1599 if (unlikely(!s)) return 0; | 1600 if (unlikely(!s)) return 0; |
1600 int i = 0; | 1601 int i = 0; |
1601 while (i < n && *s++ != '\0') | 1602 while (i < n && *s++ != '\0') |
1602 ++i; | 1603 ++i; |
1603 return i; | 1604 return i; |
1604 } | 1605 } |
1605 #endif | 1606 #endif |
1606 | 1607 |
1607 /* | 1608 /* |
(...skipping 402 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2010 tc = talloc_chunk_from_ptr(context); | 2011 tc = talloc_chunk_from_ptr(context); |
2011 while (tc) { | 2012 while (tc) { |
2012 if (TC_PTR_FROM_CHUNK(tc) == ptr) return 1; | 2013 if (TC_PTR_FROM_CHUNK(tc) == ptr) return 1; |
2013 while (tc && tc->prev) tc = tc->prev; | 2014 while (tc && tc->prev) tc = tc->prev; |
2014 if (tc) { | 2015 if (tc) { |
2015 tc = tc->parent; | 2016 tc = tc->parent; |
2016 } | 2017 } |
2017 } | 2018 } |
2018 return 0; | 2019 return 0; |
2019 } | 2020 } |
OLD | NEW |