Skip to content

Commit

Permalink
Merge pull request #11122 from L-as/fix-ub
Browse files Browse the repository at this point in the history
Fix ub
  • Loading branch information
Ericson2314 authored Jul 16, 2024
2 parents 8f22245 + a1f3f10 commit 463256b
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/libstore/build/derivation-goal.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1569,7 +1569,7 @@ void DerivationGoal::waiteeDone(GoalPtr waitee, ExitCode result)
{
Goal::waiteeDone(waitee, result);

if (!useDerivation) return;
if (!useDerivation || !drv) return;
auto & fullDrv = *dynamic_cast<Derivation *>(drv.get());

auto * dg = dynamic_cast<DerivationGoal *>(&*waitee);
Expand Down
5 changes: 3 additions & 2 deletions tests/unit/libutil-support/tests/string_callback.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@

namespace nix::testing {

void observe_string_cb(const char * start, unsigned int n, std::string * user_data)
void observe_string_cb(const char * start, unsigned int n, void * user_data)
{
*user_data = std::string(start);
auto user_data_casted = reinterpret_cast<std::string *>(user_data);
*user_data_casted = std::string(start);
}

}
5 changes: 2 additions & 3 deletions tests/unit/libutil-support/tests/string_callback.hh
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,13 @@

namespace nix::testing {

void observe_string_cb(const char * start, unsigned int n, std::string * user_data);
void observe_string_cb(const char * start, unsigned int n, void * user_data);

inline void * observe_string_cb_data(std::string & out)
{
return (void *) &out;
};

#define OBSERVE_STRING(str) \
(nix_get_string_callback) nix::testing::observe_string_cb, nix::testing::observe_string_cb_data(str)
#define OBSERVE_STRING(str) nix::testing::observe_string_cb, nix::testing::observe_string_cb_data(str)

}

0 comments on commit 463256b

Please sign in to comment.