Skip to content

Commit

Permalink
Build fix: unify PbufDeleters
Browse files Browse the repository at this point in the history
  • Loading branch information
vorner authored and danopernis committed Jun 5, 2024
1 parent dbd0c90 commit d87bd5b
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 14 deletions.
8 changes: 1 addition & 7 deletions lib/WUI/nhttp/server.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
#include "handler.h"

#include <automata/core.h>
#include <common/pbuf_deleter.hpp>

#include <lwip/altcp.h>
#include <lwip/tcpip.h>
Expand Down Expand Up @@ -94,13 +95,6 @@ class ServerDefs {
*/
class Server {
private:
class PbufDeleter {
public:
void operator()(pbuf *buff) {
pbuf_free(buff);
}
};

class ListenerDeleter {
public:
void operator()(altcp_pcb *conn) {
Expand Down
10 changes: 10 additions & 0 deletions src/common/pbuf_deleter.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#pragma once

#include <lwip/pbuf.h>

class PbufDeleter {
public:
void operator()(pbuf *buff) {
pbuf_free(buff);
}
};
8 changes: 1 addition & 7 deletions src/transfers/download.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
// Avoid deep transitive dependency hell in unit tests...
#include <nhttp/server.h>
#endif
#include <common/pbuf_deleter.hpp>
#include <nhttp/splice.h>
#include <http_lifetime.h>
#include <timing.h>
Expand Down Expand Up @@ -275,13 +276,6 @@ class Download::Async {
done(DownloadStep::FailedNetwork);
return ERR_ABRT;
}
// TODO: Unify with the one in server.h
class PbufDeleter {
public:
void operator()(pbuf *buff) {
pbuf_free(buff);
}
};
unique_ptr<pbuf, PbufDeleter> data(data_raw);
if (phase != Phase::Headers) {
done(DownloadStep::Aborted);
Expand Down

0 comments on commit d87bd5b

Please sign in to comment.