ReactOS 0.4.16-dev-2110-ge3521eb
strncmp.c File Reference
#include <string.h>
Include dependency graph for strncmp.c:

Go to the source code of this file.

Functions

int __cdecl strncmp (const char *first, const char *last, size_t count)
 

Function Documentation

◆ strncmp()

int __cdecl strncmp ( const char first,
const char last,
size_t  count 
)

Definition at line 40 of file strncmp.c.

46{
47 size_t x = 0;
48
49 if (!count)
50 {
51 return 0;
52 }
53
54 /*
55 * This explicit guard needed to deal correctly with boundary
56 * cases: strings shorter than 4 bytes and strings longer than
57 * UINT_MAX-4 bytes .
58 */
59 if( count >= 4 )
60 {
61 /* unroll by four */
62 for (; x < count-4; x+=4)
63 {
64 first+=4;
65 last +=4;
66
67 if (*(first-4) == 0 || *(first-4) != *(last-4))
68 {
69 return(*(unsigned char *)(first-4) - *(unsigned char *)(last-4));
70 }
71
72 if (*(first-3) == 0 || *(first-3) != *(last-3))
73 {
74 return(*(unsigned char *)(first-3) - *(unsigned char *)(last-3));
75 }
76
77 if (*(first-2) == 0 || *(first-2) != *(last-2))
78 {
79 return(*(unsigned char *)(first-2) - *(unsigned char *)(last-2));
80 }
81
82 if (*(first-1) == 0 || *(first-1) != *(last-1))
83 {
84 return(*(unsigned char *)(first-1) - *(unsigned char *)(last-1));
85 }
86 }
87 }
88
89 /* residual loop */
90 for (; x < count; x++)
91 {
92 if (*first == 0 || *first != *last)
93 {
94 return(*(unsigned char *)first - *(unsigned char *)last);
95 }
96 first+=1;
97 last+=1;
98 }
99
100 return 0;
101}
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
GLuint GLuint GLsizei count
Definition: gl.h:1545
const GLint * first
Definition: glext.h:5794
static UINT UINT last
Definition: font.c:45

Referenced by _ecvt(), _FindPESectionByName(), _mbsnbcmp_l(), _mbsncmp_l(), _strncoll(), _strncoll_l(), _TIFFPrettyPrintField(), _TIFFSetupFields(), _tmain(), AbsoluteToRelative(), add_file(), alloc_rootdir_entry(), ArcOpen(), ata_bblk(), auto_rename(), bad_name(), BlArchGetCpuVendor(), cache_containers_find(), change_section_attribs(), check_4_special_identifiers(), check_atari(), check_dir(), check_file(), check_in_programs_list(), check_menu_item_info(), check_output(), check_rr_dates(), check_rr_relocation(), CheckForNewV3User(), cl_exid_compare(), ClassNametoClassID(), ClasspMyStringMatches(), cmpEnvironment(), compare_query_(), ConMgrProcessInputLine(), ConvertPathCase(), CopyTest::copy_array(), create_sic(), CreateOutputFile(), D3DXGetImageInfoFromFileInMemory(), d3dxinclude_open(), DecodeURLString(), default_init(), Deletehost(), DetectPnpBios(), DiskDetermineMediaTypes(), DoCommand(), domacro(), doWinMain(), driver_fixup(), editor_handle_message(), EfiInitpCreateApplicationEntry(), encodeAndCompareBase64_A(), XMLStorage::XMLReaderBase::EndElementHandler(), enum_password_proc(), errflags(), ext_in_list(), externalui_message_callback(), FATAddEntry(), FatDetermineFatType(), file_add(), file_cd(), file_find(), file_name(), FileToURL(), find_html_symbol(), find_matching_rdn_attr(), find_rr_attribute(), FindDefine(), findend(), FsRecIsUdfsVolume(), FTPDecodeURL(), FTPFileModificationTime(), FxVerifyLogHeader(), get_annotation_by_name(), get_constant_by_name(), get_cpu_from_name(), get_drive_connection(), get_fileinfo(), get_parameter_by_name(), get_platform_from_name(), get_valid_parameter(), get_valid_parameter_block(), getInterfaceInfoByName(), getnetconfigent(), getopt_long(), GetResponse(), GetStabInfo(), tinyxml2::StrPair::GetStr(), GetSystemName(), gl_histadd(), HaliMPBusInfo(), handle_apetag(), handle_dot(), handle_gdb_query(), handle_gdb_set_thread(), handle_gdb_v(), handle_setexattr(), XMLStorage::Buffer::has_CDEnd(), has_extension(), HttpHeaders_test(), HttpSendRequestEx_test(), id3_link(), import_base64_certs_from_fp(), InitializeLibrary(), InternalIsOS2OrOldWin(), is_cygwin_ea(), is_valid_file(), iso2022jp_mbtowc(), iso2022jp_wctomb(), IsVesaBiosOk(), joliet_compare_dirs(), KdbpCliInterpretInitFile(), KdDebuggerInitialize0(), KdInitSystem(), lwip_strnstr(), mac_cmp(), macho_load_section_info(), main(), map_nfs4ace_who(), match_line(), ME_StreamIn(), merge_isofs(), MiFindInitializationCode(), mkstemps(), MPEGSplitter_pre_connect(), multi_addr_find(), name_cmp(), netname2host(), netname2user(), nfs41_abs_path_compare(), nsIOService_NewURI(), ntlm_AcceptSecurityContext(), ntlm_InitializeSecurityContextW(), OmNavigator_get_appVersion(), XMLStorage::XMLReaderBase::parse(), parse_arguments(), parse_file(), parse_new_id3(), parse_options(), parse_rr(), parse_rrflags(), ParseCommandLine(), ParseFile(), ParseHostLine(), ParseInputFile(), tinyxml2::StrPair::ParseText(), Phase1InitializationDiscard(), pipe_thread(), print_insn(), PrintNameTable(), PrintStrangeMenu(), process_long_option(), process_optarg(), promote_framename(), PutBookmark(), read_merging_directory(), ReadStyleSheet(), RemoteCompletionFunction(), RemoteGlobCollapse(), RichEditWndProc_common(), RpcStringBindingParseA(), run_helper(), SendCommand(), server_compare(), server_ddeml_callback(), setpeer(), setup_dinput_options(), TestCase::shouldRunThis(), START_TEST(), str_startswith(), StrDupShortenPath(), tinyxml2::XMLUtil::StringEqual(), StringExpands(), strrstr(), strstr(), subdirs(), test_asciimode2(), test_cache_read_gzipped(), test_CertRDNValueToStrA(), test_ConvertINetUnicodeToMultiByte(), test_DEVMODEA(), test_EM_GETLINE(), test_Environment(), test_FakeDLL(), test_filter_graph(), test_find_executable(), test_GetDateFormatA(), test_GetModuleFileNameEx(), test_GetProcessImageFileNameA(), test_GetVolumeNameForVolumeMountPointA(), test_I10_OUTPUT(), test_IMultiLanguage2_ConvertStringFromUnicode(), test_ip_pktinfo(), test_midiOut_device(), test_midiStream(), test_MsiEnumPatchesEx_usermanaged(), test_MsiGetFileVersion(), test_MsiGetProductProperty(), test_MsiGetSourcePath(), test_msirecord(), test_mxwriter_encoding(), test_navigator(), test_OpenFile(), test_PathUnExpandEnvStrings(), test_query_process_image_file_name(), test_RtlCopyString(), test_setlocale(), test_SHGetFolderPathAndSubDirA(), test_sscanf(), test_WM_GETTEXT(), test_WNetCachePassword(), test_xcvt(), testD3DInclude_open(), testD3DXInclude_open(), TIFFCleanup(), translate_files(), TRIO_ARGS3(), TypeNametoTypeID(), u_strncmp(), UDFFindVRS(), UDFGetDiskInfo(), UDFLoadLogicalVol(), UnLslR(), UnMDTMDate(), urlcache_entry_commit(), UrlCompareA(), UrlGetLocationA(), VfdGetDriverConfig(), VfdGetImageInfo(), WinHttpGetDefaultProxyConfiguration(), WinLdrSetupEms(), write_dlldata(), and xmlStrncmp().