Changeset c1a1f2c in rtems


Ignore:
Timestamp:
Sep 10, 2019, 7:21:11 AM (6 weeks ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
master
Children:
a4e96cf
Parents:
5e5867a3
git-author:
Sebastian Huber <sebastian.huber@…> (09/10/19 07:21:11)
git-committer:
Sebastian Huber <sebastian.huber@…> (09/11/19 05:28:34)
Message:

Add rtems_version_control_key_is_valid()

Files:
2 edited

Legend:

Unmodified
Added
Removed
  • cpukit/include/rtems/version.h

    r5e5867a3 rc1a1f2c  
    1616#ifndef _RTEMS_VERSION_H
    1717#define _RTEMS_VERSION_H
     18
     19#include <stdbool.h>
    1820
    1921#ifdef __cplusplus
     
    6668 * built version to be identified.
    6769 *
    68  * @return The version control key or the empty string if no version control
    69  * key is available.
     70 * Use rtems_version_control_key_is_valid() to check if the version control key
     71 * is valid.
     72 *
     73 * @return The version control key.
    7074 */
    7175const char *rtems_version_control_key( void );
     76
     77/**
     78 * @brief Returns true, if the version control key is valid, otherwise false.
     79 *
     80 * @retval true The version control key is valid.
     81 * @retval false Otherwise.
     82 */
     83static inline bool rtems_version_control_key_is_valid( const char *key )
     84{
     85  return key[ 0 ] != '\0';
     86}
    7287
    7388/**
  • testsuites/sptests/spversion01/init.c

    r5e5867a3 rc1a1f2c  
    2323)
    2424{
     25  const char *key;
     26  const char *valid;
     27
    2528  TEST_BEGIN();
     29
     30  key = rtems_version_control_key();
     31  valid = rtems_version_control_key_is_valid(key) ? "valid" : "invalid";
    2632
    2733  printf("Release  : %s\n", rtems_version());
     
    2935  printf("Minor    : %d\n", rtems_version_minor());
    3036  printf("Revision : %d\n", rtems_version_revision());
    31   printf("VC Key   : %s\n", rtems_version_control_key());
     37  printf("VC Key   : %s (%s)\n", key, valid);
    3238  printf("BSP      : %s\n", rtems_board_support_package());
    3339
Note: See TracChangeset for help on using the changeset viewer.