apr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jor...@apache.org
Subject svn commit: r1817892 - in /apr/apr/trunk: CHANGES include/apr_pools.h memory/unix/apr_pools.c test/testpools.c
Date Tue, 12 Dec 2017 08:33:19 GMT
Author: jorton
Date: Tue Dec 12 08:33:18 2017
New Revision: 1817892

URL: http://svn.apache.org/viewvc?rev=1817892&view=rev
Log:
Add apr_pool_get_tag to retrieve the pool tag name.

* memory/unix/apr_pools.c (apr_pool_get_tag): New function.

* test/testpools.c: Test it.

Modified:
    apr/apr/trunk/CHANGES
    apr/apr/trunk/include/apr_pools.h
    apr/apr/trunk/memory/unix/apr_pools.c
    apr/apr/trunk/test/testpools.c

Modified: apr/apr/trunk/CHANGES
URL: http://svn.apache.org/viewvc/apr/apr/trunk/CHANGES?rev=1817892&r1=1817891&r2=1817892&view=diff
==============================================================================
--- apr/apr/trunk/CHANGES [utf-8] (original)
+++ apr/apr/trunk/CHANGES [utf-8] Tue Dec 12 08:33:18 2017
@@ -1,6 +1,8 @@
                                                      -*- coding: utf-8 -*-
 Changes for APR 2.0.0
 
+  *) Add apr_pool_tag_get to retrieve the pool tag name.  [Joe Orton]
+
   *) Add apr_sockaddr_zone_set, apr_sockaddr_zone_set to set and retrieve
      the zone for link-local IPv6 addresses.  [Joe Orton]
 

Modified: apr/apr/trunk/include/apr_pools.h
URL: http://svn.apache.org/viewvc/apr/apr/trunk/include/apr_pools.h?rev=1817892&r1=1817891&r2=1817892&view=diff
==============================================================================
--- apr/apr/trunk/include/apr_pools.h (original)
+++ apr/apr/trunk/include/apr_pools.h Tue Dec 12 08:33:18 2017
@@ -508,6 +508,13 @@ APR_DECLARE(int) apr_pool_is_ancestor(ap
 APR_DECLARE(void) apr_pool_tag(apr_pool_t *pool, const char *tag)
                   __attribute__((nonnull(1)));
 
+/**
+ * Retrieve the tag name.
+ * @param pool The pool
+ * @return Tag name, or NULL if no name is set.
+ */
+APR_DECLARE(const char *) apr_pool_get_tag(apr_pool_t *pool)
+                  __attribute__((nonnull(1)));
 
 /*
  * User data management

Modified: apr/apr/trunk/memory/unix/apr_pools.c
URL: http://svn.apache.org/viewvc/apr/apr/trunk/memory/unix/apr_pools.c?rev=1817892&r1=1817891&r2=1817892&view=diff
==============================================================================
--- apr/apr/trunk/memory/unix/apr_pools.c (original)
+++ apr/apr/trunk/memory/unix/apr_pools.c Tue Dec 12 08:33:18 2017
@@ -2432,6 +2432,10 @@ APR_DECLARE(void) apr_pool_tag(apr_pool_
     pool->tag = tag;
 }
 
+APR_DECLARE(const char *) apr_pool_get_tag(apr_pool_t *pool)
+{
+    return pool->tag;
+}
 
 /*
  * User data management

Modified: apr/apr/trunk/test/testpools.c
URL: http://svn.apache.org/viewvc/apr/apr/trunk/test/testpools.c?rev=1817892&r1=1817891&r2=1817892&view=diff
==============================================================================
--- apr/apr/trunk/test/testpools.c (original)
+++ apr/apr/trunk/test/testpools.c Tue Dec 12 08:33:18 2017
@@ -139,6 +139,13 @@ static void test_cleanups(abts_case *tc,
     }
 }
 
+static void test_tags(abts_case *tc, void *data)
+{
+    ABTS_PTR_EQUAL(tc, NULL, apr_pool_get_tag(pmain));
+    apr_pool_tag(pmain, "main pool");
+    ABTS_STR_EQUAL(tc, "main pool", apr_pool_get_tag(pmain));
+}
+
 abts_suite *testpool(abts_suite *suite)
 {
     suite = ADD_SUITE(suite)
@@ -150,6 +157,7 @@ abts_suite *testpool(abts_suite *suite)
     abts_run_test(suite, alloc_bytes, NULL);
     abts_run_test(suite, calloc_bytes, NULL);
     abts_run_test(suite, test_cleanups, NULL);
+    abts_run_test(suite, test_tags, NULL);
 
     return suite;
 }



Mime
View raw message