Skip to content

Commit

Permalink
Update sonic-swss-common for compilation on Bookworm (#825)
Browse files Browse the repository at this point in the history
* Use json.hpp from nlohmann-json-dev instead of local version

This header file comes from an external package, and a very old version of the
header file has been checked into this repo. This will cause problems for the
upcoming Bookworm upgrade.

Change references to the header file to use the Debian package
nlohmann-json-dev, and remove json.hpp from this repo.
  • Loading branch information
saiarcot895 authored Nov 7, 2023
1 parent ec0fa46 commit 0cbceed
Show file tree
Hide file tree
Showing 20 changed files with 20 additions and 8,773 deletions.
1 change: 1 addition & 0 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ jobs:
autoconf-archive \
uuid-dev \
libjansson-dev \
nlohmann-json3-dev \
python
- if: matrix.language == 'cpp'
Expand Down
31 changes: 0 additions & 31 deletions ThirdPartyLicenses.txt

This file was deleted.

2 changes: 1 addition & 1 deletion azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ stages:
steps:
- script: |
sudo apt-get update
sudo apt-get install -y make libtool m4 autoconf dh-exec debhelper cmake pkg-config \
sudo apt-get install -y make libtool m4 autoconf dh-exec debhelper cmake pkg-config nlohmann-json3-dev \
libhiredis-dev libnl-3-dev libnl-genl-3-dev libnl-route-3-dev libnl-nf-3-dev swig3.0 \
libpython2.7-dev libboost-dev libboost-serialization-dev uuid-dev libzmq5 libzmq3-dev
sudo apt-get install -y sudo
Expand Down
2 changes: 1 addition & 1 deletion common/countertable.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#include "common/redisreply.h"
#include "common/rediscommand.h"
#include "common/redisapi.h"
#include "common/json.hpp"
#include <nlohmann/json.hpp>
#include "common/schema.h"
#include "common/countertable.h"

Expand Down
2 changes: 1 addition & 1 deletion common/dbconnector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#include <errno.h>
#include <system_error>
#include <fstream>
#include "json.hpp"
#include <nlohmann/json.hpp>
#include "logger.h"

#include "common/dbconnector.h"
Expand Down
6 changes: 3 additions & 3 deletions common/events.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -365,7 +365,7 @@ EventSubscriber::init(bool use_cache, int recv_timeout,
RET_ON_ERR(rc == 0, "Fails to set option rc=%d", rc);
}
else {
for (const auto e: *subs_sources) {
for (const auto &e: *subs_sources) {
rc = zmq_setsockopt(sock, ZMQ_SUBSCRIBE, e.c_str(), e.size());
RET_ON_ERR(rc == 0, "Fails to set option rc=%d", rc);
}
Expand Down Expand Up @@ -400,14 +400,14 @@ EventSubscriber::prune_track()
map<time_t, vector<runtime_id_t> > lst;

/* Sort entries by last touched time */
for(const auto e: m_track) {
for(const auto &e: m_track) {
lst[e.second.epoch_secs].push_back(e.first);
}

/* By default it walks from lowest value / earliest timestamp */
map<time_t, vector<runtime_id_t> >::const_iterator itc = lst.begin();
for(; (itc != lst.end()) && (m_track.size() > MAX_PUBLISHERS_COUNT); ++itc) {
for (const auto r: itc->second) {
for (const auto &r: itc->second) {
m_track.erase(r);
}
}
Expand Down
2 changes: 1 addition & 1 deletion common/events_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
#include <errno.h>
#include <cxxabi.h>
#include "string.h"
#include "json.hpp"
#include <nlohmann/json.hpp>
#include "zmq.h"
#include <unordered_map>
#include <boost/serialization/vector.hpp>
Expand Down
2 changes: 1 addition & 1 deletion common/events_pi.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#include <fstream>
#include <uuid/uuid.h>
#include "string.h"
#include "json.hpp"
#include <nlohmann/json.hpp>
#include "zmq.h"
#include <unordered_map>

Expand Down
2 changes: 1 addition & 1 deletion common/json.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#include <limits>

#include "common/json.h"
#include "common/json.hpp"
#include <nlohmann/json.hpp>

using namespace std;

Expand Down
Loading

0 comments on commit 0cbceed

Please sign in to comment.