Skip to content

Commit

Permalink
Cosmetic (#909)
Browse files Browse the repository at this point in the history
* Update comment.

* Format.
  • Loading branch information
jtv authored Dec 1, 2024
1 parent 9ccae63 commit c9e8a31
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 14 deletions.
4 changes: 2 additions & 2 deletions include/pqxx/connection.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -284,8 +284,8 @@ public:
}

/// Move assignment.
/** Neither connection can have an open transaction, registered error
* handlers, or registered notification receivers.
/** Neither connection can have an open transaction, or registered
* notification receivers.
*/
connection &operator=(connection &&rhs);

Expand Down
31 changes: 19 additions & 12 deletions include/pqxx/internal/conversions.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -335,11 +335,12 @@ template<typename... T> struct nullness<std::variant<T...>>
static constexpr bool always_null = (nullness<T>::always_null and ...);
static constexpr bool is_null(std::variant<T...> const &value) noexcept
{
return value.valueless_by_exception() or std::visit(
[](auto const &i) noexcept {
return nullness<strip_t<decltype(i)>>::is_null(i);
},
value);
return value.valueless_by_exception() or
std::visit(
[](auto const &i) noexcept {
return nullness<strip_t<decltype(i)>>::is_null(i);
},
value);
}

// We don't support `null()` for `std::variant`.
Expand Down Expand Up @@ -517,8 +518,10 @@ template<> struct string_traits<char const *>

static std::size_t size_buffer(char const *const &value) noexcept
{
if (pqxx::is_null(value)) return 0;
else return std::strlen(value) + 1;
if (pqxx::is_null(value))
return 0;
else
return std::strlen(value) + 1;
}
};

Expand Down Expand Up @@ -551,8 +554,10 @@ template<> struct string_traits<char *>
}
static std::size_t size_buffer(char *const &value) noexcept
{
if (pqxx::is_null(value)) return 0;
else return string_traits<char const *>::size_buffer(value);
if (pqxx::is_null(value))
return 0;
else
return string_traits<char const *>::size_buffer(value);
}

/// Don't allow conversion to this type since it breaks const-safety.
Expand Down Expand Up @@ -871,8 +876,10 @@ template<typename T> struct string_traits<std::shared_ptr<T>>
}
static std::size_t size_buffer(std::shared_ptr<T> const &value) noexcept
{
if (pqxx::is_null(value)) return 0;
else return pqxx::size_buffer(*value);
if (pqxx::is_null(value))
return 0;
else
return pqxx::size_buffer(*value);
}
};

Expand Down Expand Up @@ -1123,7 +1130,7 @@ public:
[](std::size_t acc, elt_type const &elt) {
// Opening and closing quotes, plus worst-case escaping,
// and the one byte for the trailing zero becomes room
// for a separator.
// for a separator.
std::size_t const elt_size{
pqxx::is_null(elt) ? std::size(s_null) :
elt_traits::size_buffer(elt)};
Expand Down

0 comments on commit c9e8a31

Please sign in to comment.