Blame src/internal/slibtool_coff_impl.c

886c09
/*******************************************************************/
886c09
/*  slibtool: a strong libtool implementation, written in C        */
886c09
/*  Copyright (C) 2016--2024  SysDeer Technologies, LLC            */
886c09
/*  Released under the Standard MIT License; see COPYING.SLIBTOOL. */
886c09
/*******************************************************************/
886c09
886c09
#include <string.h>
886c09
#include "slibtool_visibility_impl.h"
886c09
fbd10d
slbt_hidden int slbt_coff_qsort_strcmp(const void * a, const void * b)
886c09
{
886c09
	const char *    dot;
886c09
	const char *    mark;
886c09
	const char *    stra;
886c09
	const char *    strb;
886c09
	const char **   pstra;
886c09
	const char **   pstrb;
886c09
	char            strbufa[4096];
886c09
	char            strbufb[4096];
886c09
886c09
	pstra = (const char **)a;
886c09
	pstrb = (const char **)b;
886c09
886c09
	stra  = *pstra;
886c09
	strb  = *pstrb;
886c09
886c09
	if (!strncmp(*pstra,".weak.",6)) {
886c09
		stra = strbufa;
886c09
		mark = &(*pstra)[6];
886c09
		dot  = strchr(mark,'.');
886c09
886c09
		strncpy(strbufa,mark,dot-mark);
886c09
		strbufa[dot-mark] = '\0';
886c09
	}
886c09
886c09
	if (!strncmp(*pstrb,".weak.",6)) {
886c09
		strb = strbufb;
886c09
		mark = &(*pstrb)[6];
886c09
		dot  = strchr(mark,'.');
886c09
886c09
		strncpy(strbufb,mark,dot-mark);
886c09
		strbufb[dot-mark] = '\0';
886c09
	}
886c09
886c09
	return strcmp(stra,strb);
886c09
}