Skip to content

Commit

Permalink
Permit appending native strings to StringBuf
Browse files Browse the repository at this point in the history
C strings need to be converted anyhow, but this avoids double conversion
for native strings.
  • Loading branch information
pmatilai committed May 17, 2024
1 parent 749f1ce commit 556d514
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion build/misc.c
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ const char * getStringBuf(StringBuf sb)
return (sb != NULL) ? sb->buf.c_str() : NULL;
}

void appendStringBufAux(StringBuf sb, const char *s, int nl)
void appendStringBufAux(StringBuf sb, const std::string & s, int nl)
{
sb->buf += s;
if (nl)
Expand Down
4 changes: 3 additions & 1 deletion build/rpmbuild_misc.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
#ifndef _RPMBUILD_MISC_H
#define _RPMBUILD_MISC_H

#include <string>

#include <sys/types.h>
#include <rpm/rpmtypes.h>
#include <rpm/rpmds.h>
Expand Down Expand Up @@ -51,7 +53,7 @@ void stripTrailingBlanksStringBuf(StringBuf sb);
/** \ingroup rpmstring
*/
RPM_GNUC_INTERNAL
void appendStringBufAux(StringBuf sb, const char * s, int nl);
void appendStringBufAux(StringBuf sb, const std::string & s, int nl);

/** \ingroup rpmbuild
* Parse an unsigned number.
Expand Down

0 comments on commit 556d514

Please sign in to comment.