Refine code.
This commit is contained in:
parent
2fbe6d046f
commit
28c9481387
1
.gitignore
vendored
1
.gitignore
vendored
|
|
@ -29,7 +29,6 @@
|
|||
# Apple-specific garbage files.
|
||||
.AppleDouble
|
||||
.idea
|
||||
.gitignore
|
||||
.cursor/
|
||||
.DS_Store
|
||||
*.heap
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@
|
|||
#include <srs_core.hpp>
|
||||
|
||||
// Unique ptr smart pointer, only support unique ptr, with limited APIs and features,
|
||||
// see https://github.com/ossrs/srs/discussions/3667#discussioncomment-8969107
|
||||
// see https://github.com/ossrs/srs/issues/4551
|
||||
//
|
||||
// Usage:
|
||||
// SrsUniquePtr<MyClass> ptr(new MyClass());
|
||||
|
|
@ -89,7 +89,7 @@ SRS_DECLARE_PRIVATE: // clang-format on
|
|||
};
|
||||
|
||||
// The unique ptr for array objects, only support unique ptr, with limited APIs and features,
|
||||
// see https://github.com/ossrs/srs/discussions/3667#discussioncomment-8969107
|
||||
// see https://github.com/ossrs/srs/issues/4551
|
||||
//
|
||||
// Usage:
|
||||
// SrsUniquePtr<MyClass[]> ptr(new MyClass[10]);
|
||||
|
|
@ -156,7 +156,7 @@ SRS_DECLARE_PRIVATE: // clang-format on
|
|||
};
|
||||
|
||||
// Shared ptr smart pointer, only support shared ptr, no weak ptr, no shared from this, no inheritance,
|
||||
// no comparing, see https://github.com/ossrs/srs/discussions/3667#discussioncomment-8969107
|
||||
// no comparing, see https://github.com/ossrs/srs/issues/4551
|
||||
//
|
||||
// Usage:
|
||||
// SrsSharedPtr<MyClass> ptr(new MyClass());
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@
|
|||
// SrsAutoFree(MyClass, p); // p will be freed even p is changed later.
|
||||
// SrsUniquePtr ptr(p); // crash because p is an invalid pointer.
|
||||
//
|
||||
// See https://github.com/ossrs/srs/discussions/3667#discussioncomment-8969107 for more details.
|
||||
// See https://github.com/ossrs/srs/issues/4551 for more details.
|
||||
//
|
||||
// To delete array. Please use SrsUniquePtr instead. For example:
|
||||
// MyClass** pa = new MyClass*[size];
|
||||
|
|
@ -37,7 +37,7 @@
|
|||
// SrsAutoFreeA(MyClass*, pa); // pa will be freed even pa is changed later.
|
||||
// SrsUniquePtr<MyClass[]> ptr(pa); // crash because pa is an invalid pointer.
|
||||
//
|
||||
// See https://github.com/ossrs/srs/discussions/3667#discussioncomment-8969107 for more details.
|
||||
// See https://github.com/ossrs/srs/issues/4551 for more details.
|
||||
//
|
||||
// Use hook instead of delete. Please use SrsUniquePtr instead. For example:
|
||||
// addrinfo* r = NULL;
|
||||
|
|
@ -54,7 +54,7 @@
|
|||
// SrsAutoFreeH(addrinfo, r, freeaddrinfo); // r will be freed even r is changed later.
|
||||
// SrsUniquePtr<addrinfo> ptr(r, freeaddrinfo); // crash because r is an invalid pointer.
|
||||
//
|
||||
// See https://github.com/ossrs/srs/discussions/3667#discussioncomment-8969107 for more details.
|
||||
// See https://github.com/ossrs/srs/issues/4551 for more details.
|
||||
//
|
||||
// The template implementation.
|
||||
// template<class T>
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user