From ed3220f37fa03e0f08c07a644894efef671a5a9d Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Mon, 24 Apr 2017 20:16:18 +0200 Subject: [PATCH] util/{Foreign,Static}FifoBuffer: use C++11 initializers --- src/util/ForeignFifoBuffer.hxx | 8 ++++---- src/util/StaticFifoBuffer.hxx | 7 ++----- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/src/util/ForeignFifoBuffer.hxx b/src/util/ForeignFifoBuffer.hxx index 369fcca22..d90cb59d1 100644 --- a/src/util/ForeignFifoBuffer.hxx +++ b/src/util/ForeignFifoBuffer.hxx @@ -1,5 +1,5 @@ /* - * Copyright (C) 2003-2014 Max Kellermann + * Copyright (C) 2003-2017 Max Kellermann * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -57,15 +57,15 @@ public: typedef typename Range::const_pointer_type const_pointer_type; protected: - size_type head, tail, capacity; + size_type head = 0, tail = 0, capacity; T *data; public: explicit constexpr ForeignFifoBuffer(std::nullptr_t n) - :head(0), tail(0), capacity(0), data(n) {} + :capacity(0), data(n) {} constexpr ForeignFifoBuffer(T *_data, size_type _capacity) - :head(0), tail(0), capacity(_capacity), data(_data) {} + :capacity(_capacity), data(_data) {} ForeignFifoBuffer(ForeignFifoBuffer &&src) :head(src.head), tail(src.tail), diff --git a/src/util/StaticFifoBuffer.hxx b/src/util/StaticFifoBuffer.hxx index 2d51f22b3..cba11f9e0 100644 --- a/src/util/StaticFifoBuffer.hxx +++ b/src/util/StaticFifoBuffer.hxx @@ -1,5 +1,5 @@ /* - * Copyright (C) 2003-2014 Max Kellermann + * Copyright (C) 2003-2017 Max Kellermann * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -52,13 +52,10 @@ public: typedef WritableBuffer Range; protected: - size_type head, tail; + size_type head = 0, tail = 0; T data[size]; public: - constexpr - StaticFifoBuffer():head(0), tail(0) {} - void Shift() { if (head == 0) return;