Remove PushNull API from forwards/calls.

This appears to have no users, as it was not really possible to take
advantage of due to language constraints.
This commit is contained in:
David Anderson
2026-05-24 13:25:34 -07:00
parent 483cd9f5a8
commit e87291362b
8 changed files with 13 additions and 83 deletions
+3 -1
View File
@@ -246,7 +246,6 @@ class SMConfig(object):
'-Wno-array-bounds',
'-Wno-unknown-pragmas',
'-Wno-dangling-else',
'-Wno-uninitialized-const-pointer',
'-fvisibility=hidden',
]
if cxx.target.arch in ['x86', 'x86_64']:
@@ -304,6 +303,9 @@ class SMConfig(object):
'-Wno-tautological-overlap-compare',
]
if cxx.version >= 'clang-21.0':
cxx.cflags += ['-Wno-uninitialized-const-pointer']
if have_gcc:
cxx.cflags += ['-mfpmath=sse']
cxx.cflags += ['-Wno-maybe-uninitialized']
+6 -24
View File
@@ -232,12 +232,10 @@ bool CForward::ProcessArguments(const CallArgs& args) {
}
break;
case CallArgs::ARG_ARRAY:
case CallArgs::ARG_NULL_VECTOR:
if (pt != Param_Array)
return !!SetError(SP_ERROR_PARAM);
break;
case CallArgs::ARG_CHAR_ARRAY:
case CallArgs::ARG_NULL_STRING:
if (pt != Param_String)
return !!SetError(SP_ERROR_PARAM);
break;
@@ -377,13 +375,10 @@ int CForward::PushFloatByRef(float *num, int flags)
int CForward::PushArray(cell_t *inarray, unsigned int cells, int flags)
{
if (inarray) {
default_args_.PushArray(inarray, cells, flags);
} else {
if (cells != 3)
return SetError(SP_ERROR_PARAM);
default_args_.PushNullVector();
if (!inarray) {
return SetError(SP_ERROR_PARAM);
}
default_args_.PushArray(inarray, cells, flags);
if (default_args_.error)
return SetError(SP_ERROR_PARAMS_MAX);
return SP_ERROR_NONE;
@@ -391,11 +386,10 @@ int CForward::PushArray(cell_t *inarray, unsigned int cells, int flags)
int CForward::PushString(const char *string)
{
if (string) {
default_args_.PushString(string);
} else {
default_args_.PushNullString();
if (!string) {
return SetError(SP_ERROR_PARAM);
}
default_args_.PushString(string);
if (default_args_.error)
return SetError(SP_ERROR_PARAMS_MAX);
return SP_ERROR_NONE;
@@ -409,18 +403,6 @@ int CForward::PushStringEx(char *buffer, size_t length, int sz_flags, int cp_fla
return SP_ERROR_NONE;
}
int CForward::PushNullString()
{
default_args_.PushNullString();
return SP_ERROR_NONE;
}
int CForward::PushNullVector()
{
default_args_.PushNullVector();
return SP_ERROR_NONE;
}
void CForward::Cancel()
{
default_args_.Reset();
-2
View File
@@ -73,8 +73,6 @@ private:
CForward(ExecType et, const char *name,
const ParamType *types, unsigned num_params);
int PushNullString();
int PushNullVector();
inline int SetError(int err)
{
m_errstate = err;
-32
View File
@@ -532,36 +532,6 @@ static cell_t sm_CallPushStringEx(IPluginContext *pContext, const cell_t *params
return 1;
}
static cell_t sm_CallPushNullVector(IPluginContext *pContext, const cell_t *params)
{
if (!s_CallStarted)
{
return pContext->ThrowNativeError("Cannot push parameters when there is no call in progress");
}
sArgs.PushNullVector();
if (sArgs.error)
return pContext->ThrowNativeErrorEx(SP_ERROR_PARAMS_MAX, nullptr);
return 1;
}
static cell_t sm_CallPushNullString(IPluginContext *pContext, const cell_t *params)
{
if (!s_CallStarted)
{
return pContext->ThrowNativeError("Cannot push parameters when there is no call in progress");
}
sArgs.PushNullString();
if (sArgs.error)
return pContext->ThrowNativeErrorEx(SP_ERROR_PARAMS_MAX, nullptr);
return 1;
}
static cell_t sm_CallFinish(IPluginContext *pContext, const cell_t *params)
{
cell_t *result;
@@ -681,8 +651,6 @@ REGISTER_NATIVES(functionNatives)
{"Call_PushArrayEx", sm_CallPushArrayEx},
{"Call_PushString", sm_CallPushString},
{"Call_PushStringEx", sm_CallPushStringEx},
{"Call_PushNullVector", sm_CallPushNullVector},
{"Call_PushNullString", sm_CallPushNullString},
{"Call_Finish", sm_CallFinish},
{"Call_Cancel", sm_CallCancel},
{"RequestFrame", sm_AddFrameAction},
-19
View File
@@ -357,16 +357,6 @@ native void Call_PushArray(const any[] value, int size);
*/
native void Call_PushArrayEx(any[] value, int size, int cpflags);
/**
* Pushes the NULL_VECTOR onto the current call.
* @see IsNullVector
*
* @note Cannot be used before a call has been started.
*
* @error Called before a call has been started.
*/
native void Call_PushNullVector();
/**
* Pushes a string onto the current call.
*
@@ -394,15 +384,6 @@ native void Call_PushString(const char[] value);
*/
native void Call_PushStringEx(char[] value, int length, int szflags, int cpflags);
/**
* Pushes the NULL_STRING onto the current call.
* @see IsNullString
*
* @note Cannot be used before a call has been started.
*
* @error Called before a call has been started.
*/
native void Call_PushNullString();
/**
* Completes a call to a function or forward's call list.
+2 -3
View File
@@ -181,8 +181,7 @@ namespace SourceMod
* @brief Pushes an array of cells onto the current call. Different rules than ICallable.
* NOTE: On Execute, the pointer passed will be modified according to the copyback rule.
*
* @param inarray Array to copy. If NULL and cells is 3 pushes a reference to the NULL_VECTOR pubvar to each callee.
* Pushing other number of cells is not allowed, unlike ICallable's version.
* @param inarray Array to copy. Must not be NULL.
* @param cells Number of cells to allocate and optionally read from the input array.
* @param flags Whether or not changes should be copied back to the input array.
* @return Error code, if any.
@@ -192,7 +191,7 @@ namespace SourceMod
/**
* @brief Pushes a string onto the current call.
*
* @param string String to push. If NULL pushes a reference to the NULL_STRING pubvar to each callee.
* @param string String to push. Must not be NULL.
* @return Error code, if any.
*/
virtual int PushString(const char *string) = 0;