]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib: iostream-pump: Use refcount as name and int as type for reference count field.
authorStephan Bosch <stephan.bosch@dovecot.fi>
Sun, 25 Feb 2018 18:18:47 +0000 (19:18 +0100)
committerAki Tuomi <aki.tuomi@dovecot.fi>
Sun, 18 Mar 2018 10:53:18 +0000 (12:53 +0200)
This is what the rest of Dovecot uses.

src/lib/iostream-pump.c

index d28ca253eb283eb6d3ef66f9ea32680f340115c0..dd53435f86646891b924ca5f08a6c00c03eddbb2 100644 (file)
@@ -11,7 +11,7 @@
 #undef iostream_pump_set_completion_callback
 
 struct iostream_pump {
-       unsigned int ref;
+       int refcount;
 
        struct istream *input;
        struct ostream *output;
@@ -119,7 +119,7 @@ iostream_pump_create(struct istream *input, struct ostream *output)
 
        /* create pump */
        pump = i_new(struct iostream_pump, 1);
-       pump->ref = 1;
+       pump->refcount = 1;
        pump->input = input;
        pump->output = output;
 
@@ -164,8 +164,9 @@ void iostream_pump_set_completion_callback(struct iostream_pump *pump,
 
 void iostream_pump_ref(struct iostream_pump *pump)
 {
-       i_assert(pump != NULL && pump->ref > 0);
-       pump->ref++;
+       i_assert(pump != NULL);
+       i_assert(pump->refcount > 0);
+       pump->refcount++;
 }
 
 void iostream_pump_unref(struct iostream_pump **pump_r)
@@ -174,8 +175,8 @@ void iostream_pump_unref(struct iostream_pump **pump_r)
        struct iostream_pump *pump = *pump_r;
        *pump_r = NULL;
 
-       i_assert(pump->ref > 0);
-       if (--pump->ref == 0) {
+       i_assert(pump->refcount > 0);
+       if (--pump->refcount == 0) {
                iostream_pump_stop(pump);
                o_stream_unref(&pump->output);
                i_stream_unref(&pump->input);